You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
specify workflow run speckit --input integration=<any> --input scope=full consistently crashes with [Errno 22] Invalid argument the moment it tries to enter the review-spec gate step on Windows.
The earlier specify step (a command step that dispatches to the AI integration) completes successfully — dispatched: true, exit_code: 0, full spec.md generated on disk. The crash happens entirely inside spec-kit's gate-step machinery, after the AI work is done.
End state: state.json shows status: "failed", current_step_index: 1, current_step_id: "review-spec", step_results.specify.status: "completed". log.jsonl shows step_started (gate) then immediately workflow_failed: [Errno 22] Invalid argument with no other context.
This is a Windows-specific failure inside the gate step itself (probably a non-UTF-8 / non-printable byte being passed to print() / open() / os.write() somewhere), not related to the AI integration or the dispatched workflow content.
A second independent run (388d3c15, same machine, same inputs) reproduces identically — the specify step completes (status: completed, dispatched: true, exit_code: 0, ~147 s of LLM work), then the gate step crashes within ~3 ms with the same [Errno 22].
There is no stack trace, no specific file path, no key/encoding hint — just the bare [Errno 22] Invalid argument recorded into log.jsonl.
Specify CLI Version
0.8.12.dev0 (from a local checkout of fork One-TheOnly:fix/cursor-agent-cli-dispatch, three commits ahead of upstream main only in src/specify_cli/integrations/cursor_agent/__init__.py, src/specify_cli/integrations/base.py, and the matching tests — those changes are PR #2631 and they only affect dispatch; they do not touch any gate-step code). Verified also with 0.8.11 upstream — same crash.
AI Agent
Reproducible across cursor-agent, claude (without API credit it never gets to the gate, but when it does), and presumably any other integration that successfully completes specify. The integration is not the cause; the crash happens after.
Operating System
Windows 10 (10.0.26200), PowerShell 7.
Python Version
Python 3.12.13 (under the specify-cliuv tool virtualenv).
Error Logs
$ specify workflow run speckit `
--input "spec=https://alidocs.dingtalk.com/i/nodes/<dingtalk-prd-node>" `
--input "integration=cursor-agent" `
--input "scope=full"
Running workflow: Full SDD Cycle (speckit)
Version: 1.0.0
▸ speckit.specify …
<~2.5 min of cursor-agent producing spec.md, all healthy>
▸ review-spec …
(no UI, no prompt, no resume hint — just the run files getting written)
# state.json
{
"run_id": "df8c4b9b",
"status": "failed",
"current_step_index": 1,
"current_step_id": "review-spec",
"step_results": {
"specify": {
"status": "completed",
"output": {"dispatched": true, "exit_code": 0, ...}
}
}
}
# log.jsonl
{"event":"step_started","step_id":"specify","type":"command", ...}
{"event":"step_completed","step_id":"specify","status":"completed", ...}
{"event":"step_started","step_id":"review-spec","type":"gate", ...}
{"event":"workflow_failed","error":"[Errno 22] Invalid argument", ...}
Additional Context
Suggested investigation directions
Most likely culprit: the gate step probably tries to write a Unicode prompt or read interactive input on Windows where the underlying handle isn't an interactive TTY (e.g. a redirected stdout from PowerShell Tee-Object, or a subprocess.run with text=True but a binary stream underneath). WinError 22 / [Errno 22] on Windows typically maps to EINVAL from WriteConsole/ReadConsole when the console handle is invalid for the requested operation.
Quick verification: wrap the gate step's initial output in a try/except OSError and log sys.stdout.isatty(), sys.stdout.encoding, and the actual argument being passed to whatever syscall raised. That should localize the offending call within one iteration.
Possible fix sketch: if the gate step is trying to render a Rich prompt or print a UTF-8 emoji header, gate that block behind sys.stdout.isatty() (and write the same content directly into log.jsonl for non-TTY runs). Or, when running headless, transition to paused immediately and rely on specify workflow resume <run> --option approve/reject for the human decision step.
Why this matters for unattended / CI runs
Without this fix, specify workflow run speckit cannot be used in any unattended flow on Windows: it always succeeds at producing spec.md and then immediately marks the workflow failed, which prevents specify workflow resume from continuing to plan / tasks / implement. The fork PR #2631 (which makes cursor-agent dispatch headless on Windows) effectively unlocks the cursor-agent path, but the review-spec gate crash blocks the next step regardless of integration.
Workaround used while waiting for a fix
Manually edit .specify/workflows/runs/<run_id>/state.json to set status: "paused" and re-run specify workflow resume <run_id> once the gate-resume command becomes interactive — this is fragile and undocumented; a proper fix in the gate step is preferred.
Bug Description
specify workflow run speckit --input integration=<any> --input scope=fullconsistently crashes with[Errno 22] Invalid argumentthe moment it tries to enter thereview-specgate step on Windows.The earlier
specifystep (acommandstep that dispatches to the AI integration) completes successfully —dispatched: true,exit_code: 0, full spec.md generated on disk. The crash happens entirely inside spec-kit's gate-step machinery, after the AI work is done.End state:
state.jsonshowsstatus: "failed",current_step_index: 1,current_step_id: "review-spec",step_results.specify.status: "completed".log.jsonlshowsstep_started (gate)then immediatelyworkflow_failed: [Errno 22] Invalid argumentwith no other context.This is a Windows-specific failure inside the gate step itself (probably a non-UTF-8 / non-printable byte being passed to
print()/open()/os.write()somewhere), not related to the AI integration or the dispatched workflow content.Steps to Reproduce
Initialize a project with any integration that produces a successful
specifystep (claude,codex,cursor-agentafter fix(cursor-agent): enable headless CLI dispatch end-to-end (-p --trust --approve-mcps --force + Windows .cmd shim resolution) #2631, etc.).Run the bundled
speckitworkflow withscope=full:Wait for the
specifystep to complete (state.json showsstep_results.specify.status: "completed",dispatched: true,exit_code: 0).Observe immediate failure with
[Errno 22] Invalid argumentbefore any gate-step UI is displayed.Expected Behavior
After
specifycompletes, thereview-specgate (defined in workflow.yml astype: gate,options: [approve, reject],on_reject: abort) should:status: paused(notfailed)specify workflow resume <run-id>with an--option approveor--option reject(or whatever the gate-resume API is)planstepIn other words, the gate machinery should pause the run, not crash it.
Actual Behavior
log.jsonlfor a real run on this machine (df8c4b9b):{"event":"step_started","step_id":"specify","type":"command","timestamp":"2026-05-19T12:38:05.777Z"} {"event":"step_completed","step_id":"specify","status":"completed","timestamp":"2026-05-19T12:40:41.413Z"} {"event":"step_started","step_id":"review-spec","type":"gate","timestamp":"2026-05-19T12:40:41.417Z"} {"event":"workflow_failed","error":"[Errno 22] Invalid argument","timestamp":"2026-05-19T12:40:41.419Z"}A second independent run (
388d3c15, same machine, same inputs) reproduces identically — thespecifystep completes (status: completed,dispatched: true,exit_code: 0, ~147 s of LLM work), then the gate step crashes within ~3 ms with the same[Errno 22].There is no stack trace, no specific file path, no key/encoding hint — just the bare
[Errno 22] Invalid argumentrecorded intolog.jsonl.Specify CLI Version
0.8.12.dev0(from a local checkout of forkOne-TheOnly:fix/cursor-agent-cli-dispatch, three commits ahead of upstreammainonly insrc/specify_cli/integrations/cursor_agent/__init__.py,src/specify_cli/integrations/base.py, and the matching tests — those changes are PR #2631 and they only affect dispatch; they do not touch any gate-step code). Verified also with0.8.11upstream — same crash.AI Agent
Reproducible across
cursor-agent,claude(without API credit it never gets to the gate, but when it does), and presumably any other integration that successfully completesspecify. The integration is not the cause; the crash happens after.Operating System
Windows 10 (10.0.26200), PowerShell 7.
Python Version
Python 3.12.13 (under the
specify-cliuv toolvirtualenv).Error Logs
Additional Context
Suggested investigation directions
Most likely culprit: the gate step probably tries to write a Unicode prompt or read interactive input on Windows where the underlying handle isn't an interactive TTY (e.g. a redirected stdout from PowerShell
Tee-Object, or asubprocess.runwithtext=Truebut a binary stream underneath).WinError 22/[Errno 22]on Windows typically maps toEINVALfromWriteConsole/ReadConsolewhen the console handle is invalid for the requested operation.Quick verification: wrap the gate step's initial output in a
try/except OSErrorand logsys.stdout.isatty(),sys.stdout.encoding, and the actual argument being passed to whatever syscall raised. That should localize the offending call within one iteration.Possible fix sketch: if the gate step is trying to render a Rich prompt or print a UTF-8 emoji header, gate that block behind
sys.stdout.isatty()(and write the same content directly intolog.jsonlfor non-TTY runs). Or, when running headless, transition topausedimmediately and rely onspecify workflow resume <run> --option approve/rejectfor the human decision step.Why this matters for unattended / CI runs
Without this fix,
specify workflow run speckitcannot be used in any unattended flow on Windows: it always succeeds at producingspec.mdand then immediately marks the workflowfailed, which preventsspecify workflow resumefrom continuing toplan/tasks/implement. The fork PR #2631 (which makescursor-agentdispatch headless on Windows) effectively unlocks the cursor-agent path, but thereview-specgate crash blocks the next step regardless of integration.Workaround used while waiting for a fix
Manually edit
.specify/workflows/runs/<run_id>/state.jsonto setstatus: "paused"and re-runspecify workflow resume <run_id>once the gate-resume command becomes interactive — this is fragile and undocumented; a proper fix in the gate step is preferred.