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
Error: goto found 20 matching definitions for 'RunSearch'...
Hint: ...
The command exits 1 and emits no JSON. A zero-match goto --json request does use the structured error path.
Expected behavior
Every goto --json failure emits one bounded, parseable structured error.
Ambiguity includes a stable error code, command:"goto", the match count, and bounded narrowing guidance/candidates.
Human mode retains its useful current diagnostics.
Machine stdout is not mixed with unstructured human text.
Existing issue relationship
This is a direct regression/residual case of #4319. A comment on that issue records the same ambiguous goto --json plain-text failure while establishing JSON/output-stream boundaries.
Root-cause pointers
src/CodeIndex/Cli/QueryCommandRunner.Definition.cs:345-353 routes zero matches through WriteJsonOrHuman.
The ambiguous branch around lines 361-365 writes directly to stderr.
PR scope and implementation guidance
Route ambiguity through the shared structured command-error writer.
Preserve the public goto command identity, exit code, redaction, and bounded-output behavior.
Represent narrowing guidance structurally; do not place pre-serialized JSON inside a text field.
Bound candidate identities and expose authoritative total/omitted metadata if the list is sampled.
Keep human rendering derived from the same error facts where practical.
Do not change match ranking or automatically choose an ambiguous definition in this PR.
Acceptance criteria
The reproducer emits exactly one valid structured error in JSON mode.
Zero, one, and many-match paths use consistent command/error identities.
Candidate/guidance truncation is explicit and bounded.
Human mode remains actionable.
No human diagnostic contaminates machine stdout.
Tests, documentation, and changelog
Add zero/one/many match tests with JSON, human, redacted paths, candidate caps, and byte limits.
Verify stdout/stderr placement and exit codes.
Run the complete net8.0 and net9.0 test suites.
Update the query error/JSON contract documentation.
Summary
An ambiguous
goto --jsonrequest exits with human-readable stderr instead of the structured error envelope used by other JSON failures.This breaks machine consumers precisely when they need candidate-disambiguation guidance.
Reproduced against the fresh repository index with locally built cdidx v1.45.1 at
81861a14c9396cd74190edc91392ab11abfa86f8.Reproduction
Actual:
The command exits 1 and emits no JSON. A zero-match
goto --jsonrequest does use the structured error path.Expected behavior
goto --jsonfailure emits one bounded, parseable structured error.command:"goto", the match count, and bounded narrowing guidance/candidates.Existing issue relationship
This is a direct regression/residual case of #4319. A comment on that issue records the same ambiguous
goto --jsonplain-text failure while establishing JSON/output-stream boundaries.Root-cause pointers
src/CodeIndex/Cli/QueryCommandRunner.Definition.cs:345-353routes zero matches throughWriteJsonOrHuman.PR scope and implementation guidance
gotocommand identity, exit code, redaction, and bounded-output behavior.Acceptance criteria
Tests, documentation, and changelog
changelog.d/unreleased/fragment referencing Audit CLI output stream and JSON contract boundaries #4319.