Skip to content

OSError: [Errno 22] Invalid argument #85

Closed

Description

@sentry

Sentry Issue: DX-CLI-6

ExceptionGroup: unhandled errors in a TaskGroup
(5 additional frame(s) were not displayed)
...
  File "asyncio\runners.py", line 195, in run
    return runner.run(main)
  File "asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
  File "asyncio\base_events.py", line 725, in run_until_complete
    return future.result()
  File "contextlib.py", line 235, in __aexit__
    await self.gen.athrow(value)
  File "contextlib.py", line 235, in __aexit__
    await self.gen.athrow(value)

OSError: [Errno 22] Invalid argument
(5 additional frame(s) were not displayed)
...
  File "rich\console.py", line 2055, in _check_buffer
    self._write_buffer()
  File "rich\console.py", line 2091, in _write_buffer
    legacy_windows_render(buffer, LegacyWindowsTerm(self.file))
  File "rich\_windows_renderer.py", line 17, in legacy_windows_render
    term.write_styled(text, style)
  File "rich\_win32_console.py", line 441, in write_styled
    self.write_text(text)
  File "rich\_win32_console.py", line 403, in write_text
    self.flush()

ClickException: [Errno 22] Invalid argument
(3 additional frame(s) were not displayed)
...
  File "click\core.py", line 1902, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "click\core.py", line 1298, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "click\core.py", line 853, in invoke
    return callback(*args, **kwargs)
  File "deepctl_core\plugin_manager.py", line 247, in command_func
    return command_instance.execute(ctx, **kwargs)
  File "deepctl_core\base_command.py", line 136, in execute
    raise click.ClickException(str(e))

OSError: [Errno 22] Invalid argument
(7 additional frame(s) were not displayed)
...
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "__main__.py", line 10, in <module>
    sys.exit(main())

Activity

  1. lukeocodes commented on May 18, 2026

    @lukeocodes
    Contributor

    There are five more Sentry issues in dx-cli that look like the same Windows compatibility cluster. Worth consolidating into this one rather than tracking separately:

    Sentry Events Title Last seen
    DX-CLI-6 (this issue) 22 OSError: [Errno 22] Invalid argument on dg mcp 2026-05-15 01:21 UTC
    DX-CLI-7 2 OSError: [Errno 22] Invalid argument (variant) 2026-05-16
    DX-CLI-8 5 OSError: [Errno 22] Invalid argument (variant) 2026-05-16
    DX-CLI-9 1 OSError: [Errno 22] Invalid argument (variant) 2026-05-16
    DX-CLI-A 6 UnicodeEncodeError: 'charmap' codec can't encode characters in position 2-17 2026-05-17
    DX-CLI-B 1 MarkupError: closing tag with garbled characters 2026-05-17

    Common signal across all of them:

    • cli.os = windows
    • Release deepctl@0.2.24
    • Python 3.13.12
    • __main__.py:<module> in the in-app frame — fails during entry-point initialization

    The pattern is consistent with Windows cp1252 encoding choking on non-ASCII output:

    • Errno 22 Invalid argument on Windows often means a path or filename contains a character CreateFileW rejects (NUL, <, >, :, ", |, ?, *, or control chars) — OR a file descriptor flag combination Windows doesn't allow.
    • 'charmap' codec can't encode is the canonical Python-on-Windows error when stdout's default encoding (cp1252) hits a non-Latin1 character.
    • MarkupError with garbled bytes is what Rich produces when its terminal output gets corrupted mid-tag — likely the same encoding cascade.

    If this issue takes a fix, suggest closing the other five Sentry groups as merged. If we want them as separate tracking entries first, the Sentry "merge" action under each one would fold them into DX-CLI-6.

    Worth noting dg mcp is in the culprit for DX-CLI-6 specifically — that subcommand is where the failure mode lands most often.

  2. github-actions commented on Oct 12, 2026

    @github-actions
    Contributor

    This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

  3. locked as resolved and limited conversation to collaborators on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions