anomalyco / anomalyco/opencode

Tool definitions sent to models that cannot call tools (Vertex Gemini image models reject every request)

Open
#41,464 1 comment 0 reactions 1 assignee View on GitHub

@nexxeln is already working on this.

Since Aug 10, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Bug

Tool definitions are sent to models that can't call tools, so providers that reject function calling fail every request.

Vertex Gemini image models (gemini-2.5-flash-image) return:

Unable to submit request because the model does not support function calling.
Cause

capabilities.toolcall is set from provider config (provider.ts:1236) but never read when building a request. resolveTools in session/llm/request.ts filters only on permission rules and the per-message tools map, so all ~12 tools get declared regardless of the model.

Why it's hard to work around
  • The error names the model, so it looks like a provider/model problem.
  • Setting tool_call: false in config appears to be the fix but does nothing, since the flag isn't consulted in this path.
  • Denying tools by name in an agent isn't enough — agents start from "*": "allow", and you can't name a plugin-injected tool you don't know exists. Only permission: {"*": deny} works.
Repro
  1. Configure a Vertex/Google image model, e.g. gemini-2.5-flash-image.
  2. Send any message with the stock build agent.
  3. Request fails with the error above. Capturing the outgoing request shows a tools array with 12 functionDeclarations.
Version

1.18.15 (dev)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.