--json-schema file-path form (documented as primary) yields empty CLI output → no structured_output on the default-pinned CLI 2.1.160 #3
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The README,
examples/gitea-structured-output.yml, and theclaude_argsinput description all present the file-path form--json-schema /path/to/schema.jsonas the primary way to get schema-validated output. But with the CLI version this action installs by default (2.1.160, per README → Version pins /action.yml), the Claude CLI's--json-schemaflag only accepts an inline JSON schema string. Passing a file path makes the CLI exit0with zero output (empty stdout, empty stderr).The action then finds no
structured_output, hits its own fail-loud branch (base-action/src/run-claude.ts~L402: "--json-schema was provided in claude_args but Claude did not return structured_output."), and the step fails. So a consumer who follows the documented path-form recipe gets a step that fails closed on every run — silently, with no useful diagnostic from the CLI.Environment
13cde95(gitea branch; the PR #2 / "claude_args passthrough + structured_output" tree).2.1.160— the action's default install (action.yml:curl -fsSL https://claude.ai/install.sh | bash -s 2.1.160; README → Version pins).Repro (controlled A/B — identical except path vs inline)
Same outcome with the action's actual mode (
-p --verbose --output-format stream-json): the path form produces 0 bytes; the inline form's final{"type":"result",...}event carriesstructured_output. The CLI's own--helpdocuments only the inline form —--json-schema <schema>with an inline JSON example — and never mentions a file path.Impact
0, empty stdout, empty stderr. No "file not found", no schema error — nothing. The only signal is the action's downstream "did not return structured_output" failure.Where the docs steer users to the broken form
README.mdL112: "Use the file-path form (--json-schema /path/to/schema.json). An inline schema also works if single-quoted…" — recommends the path form as primary.README.mdL102 andexamples/gitea-structured-output.ymlL56:claude_args: --json-schema ${{ github.workspace }}/.gitea/review-schema.json.action.yml(claude_argsdescription): "e.g.--json-schema /path/to/schema.json".Suggested fixes (any one resolves it)
2.1.160; document the inline single-quoted form as the working one, and note the path form is unsupported on the default CLI. (README L112 / example /action.yml.)prepareRunConfig, when the token following--json-schemais a path to an existing file, read the file and substitute its contents inline before forwarding to the CLI. This makes the documented path form actually work regardless of CLI quirks.--json-schema, bump the default and document the minimum version.Context
Found while debugging
ryan/ourwhmcs's.gitea/workflows/claude-pr-auto-merge.yml, which (following this action's docs) passes--json-schema ${{ github.workspace }}/.workflow-main/.gitea/prompts/pr-review.schema.json— the path form — and would therefore produce no verdict on the first PR that reaches the review step.