Repository navigation
Description
Environment
- Jcode Version: Workshop v0.61.1
- Provider: Gemini (OAuth)
- Model:
gemini-2.5-pro - Platform: macOS
- Authentication: OAuth login succeeds successfully.
Summary
Gemini works correctly until Jcode includes its built-in tools. Any request with the default toolset enabled fails with an HTTP 400 because one of the generated function declarations contains an invalid JSON schema.
Disabling the built-in tools makes the exact same request succeed.
Steps to Reproduce
- Log into Gemini:
jcode login --provider gemini- Verify authentication:
jcode auth-test --all-configuredAuthentication succeeds:
- ✅ Credential probe
- ✅ Refresh probe
- ✅ Provider smoke (
AUTH_TEST_OK)
- Run a simple prompt:
jcode run "hello"Actual Result
Gemini returns:
Gemini generateContent failed
GenerateContentRequest.tools[0].function_declarations[25].parameters.any_of[0].required[1]: property is not defined
Earlier interactive runs also produced:
HTTP 400 Bad Request
Unable to submit request because required fields ['label'] are not defined in the schema properties.
Expected Result
The prompt should execute normally and return a response from Gemini.
Workaround
Running with built-in tools disabled works correctly:
jcode run --disable-base-tools "hello"Output:
Hello! I'm Jcode. How can I help you today?
This confirms that:
- ✅ Gemini authentication is working.
- ✅ OAuth is working.
- ✅ The provider integration is working.
- ❌ The failure only occurs when Jcode serializes the built-in tool/function declarations.
Additional Information
Running:
jcode auth-test --all-configuredreturns:
- ✅
credential_probe - ✅
refresh_probe - ✅
provider_smoke - ❌
tool_smoke
The provider itself is healthy, but tool-enabled requests fail.
My ~/.jcode/config.toml contains the default tool configuration:
[tools]
enabled = []
disabled = []
disable_base_tools = falseI do not have any custom tool configuration or custom MCP tools enabled.
Likely Cause
It appears that one of the built-in tool schemas is invalid for Gemini's JSON Schema validation.
Gemini reports:
GenerateContentRequest.tools[0].function_declarations[25].parameters.any_of[0].required[1]: property is not defined
and in another run:
required fields ['label'] are not defined in the schema properties.
This suggests that one of the generated function declarations contains a required field referencing a property that does not exist in the corresponding properties object.
OpenAI-based providers may accept this schema, but Gemini rejects it during request validation.
Reproduction Confirmation
The following commands reproduce the issue consistently:
# Works
jcode run --disable-base-tools "hello"
# Fails
jcode run "hello"This strongly indicates that the issue lies in the built-in tool schema generation rather than authentication or the Gemini provider itself.
If helpful, I'm happy to test a development build or help identify which specific built-in tool is generating the invalid schema.
Activity
1jehuang commentedon Jul 29, 2026
Thanks for the very thorough report. The
--disable-base-toolscomparison isolated it precisely, and your diagnosis was right: therequiredarray referenced a property the same object did not declare.Concretely, the
swarmtool builds mutually exclusiveanyOfaction branches solabelis required only forspawn. The spawn branch declaredrequired: ["action", "label"]but only declaredactionin its ownproperties, inheritinglabelfrom the parent schema. OpenAI-compatible providers accept that; Gemini validatesrequiredagainst the localpropertiesmap and rejects the whole request.Two changes, in #656:
requirednames that the same object does not declare, and drops arequiredarray left empty. This makes the whole provider path resilient rather than fixing one tool.labelexplicitly, so the schema is well-formed at the source. A test asserts every branch only requires properties it declares.Verified with
cargo test -p jcode-provider-gemini-runtime --lib(34 passed, 3 new) and-p jcode-app-core --lib communicate(79 passed, 1 new).I do not have Gemini OAuth credentials here, so this is verified at the schema layer rather than against the live endpoint. If you are willing to test a dev build off that branch, confirmation that
jcode run "hello"now succeeds would be genuinely useful before it ships.--- — Jcode agent (automated triage), on behalf of @1jehuang
test: catch dangling required names across the real tool registry
test: assert the CONVERTED Gemini declarations have no dangling required
1jehuang commentedon Jul 29, 2026
Final verification update, closing the last gap in how I had checked this.
My earlier tests all operated on Rust structures rather than the JSON Gemini actually receives, so they could not strictly prove the request you were sending is now valid. I have now validated the serialized wire form.
Method: pushed the real tool registry through the actual Gemini converter, serialized the result exactly as it goes on the wire, and checked every nested object against Gemini's rule that each
requiredname must appear in the same object'sproperties(plus the empty-requiredcase, which Gemini also rejects).With the fixes in place:
With both fixes reverted, i.e. the version you were running:
That is the precise cause of your HTTP 400, reproduced and then resolved in the serialized payload. It also confirms
swarmwas the only offending declaration out of 28, so there is no second instance waiting behind this one.One more thing worth reporting: I checked the two fixes independently, and either one alone is sufficient. The adapter-level pruning is therefore a genuine safety net rather than redundant, since it protects any future tool that writes
anyOfbranches this way, not just the one that broke.Committed as
240e4e89eon #656, which asserts the invariant on the converted declarations permanently, so a regression fails CI rather than reaching a user.Remaining honest caveat, unchanged: I have no Gemini credentials here, so this is verified against Gemini's documented validation rule rather than a live
generateContentcall. If you are able to run a dev build off that branch, a confirmation thatjcode run "hello"succeeds would close the loop completely.--- — Jcode agent (automated triage), on behalf of @1jehuang
fix: five triage fixes for Gemini schemas, macOS stdin, reload, MCP m…
feat(schema): replace per-provider deny-lists with a dialect system
fix: five triage fixes for Gemini schemas, macOS stdin, reload, MCP m…
test: catch dangling required names across the real tool registry
test: assert the CONVERTED Gemini declarations have no dangling required
feat(schema): replace per-provider deny-lists with a dialect system
5 remaining items
test: catch dangling required names across the real tool registry
test: assert the CONVERTED Gemini declarations have no dangling required
feat(schema): replace per-provider deny-lists with a dialect system
fix: five triage fixes for Gemini schemas, macOS stdin, reload, MCP m…
test: catch dangling required names across the real tool registry
test: assert the CONVERTED Gemini declarations have no dangling required
feat(schema): replace per-provider deny-lists with a dialect system
fix: five triage fixes for Gemini schemas, macOS stdin, reload, MCP m…
test: catch dangling required names across the real tool registry
test: assert the CONVERTED Gemini declarations have no dangling required
feat(schema): replace per-provider deny-lists with a dialect system
feat(schema): replace per-provider deny-lists with a dialect system
fix: five triage fixes for Gemini schemas, macOS stdin, reload, MCP m…
test: catch dangling required names across the real tool registry
test: assert the CONVERTED Gemini declarations have no dangling required