Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Requests with an empty tool set serialize as `"tools": []`, which strict OpenAI-compatible upstreams reject with 400

Open Beginner friendly
#58,648 4 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@chenyb999-zhcn is already working on this.

Since Oct 24, 2026.

  • #58790 by @chenyb999-zhcn — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
json, typescript
Domain
api, backend

Research direction

Start in the TypeScript AI SDK layer that serializes OpenAI-compatible model requests, locating where an empty event.tools set becomes a tools array. Reproduce the request body against a strict upstream, then add a regression test confirming that requests with no effective tools omit the tools field and succeed.

Written by the indexing model from the issue text.

Description

reproduced
  • opencode 2.0.32, Linux, openai-compatible providers.

When the effective tool set for a model request is empty — in our case a plugin's compaction takeover clears inherited tools by setting event.tools = {} on its child sessions — the AI SDK layer serializes the request body with "tools": []. Strict OpenAI-compatible upstreams reject that:

{"error": {"type": "invalid_request_error", "param": "tools",
           "message": "`tools` must not be an empty array. either provide at least one tool or omit the field entirely."}}

(HTTP 400; a second upstream answers 400 with a generic "upstream provider rejected the request". The same bodies with the tools field omitted return 200.)

Consequence here: every compaction request failed and the fallback chain exhausted — all compaction on the machine was down.

The OpenAI API treats tools as optional and accepts an empty array, and omitting the field is accepted everywhere; clients that model "no tools" as an empty set (the AI SDK's openai-compatible provider) cannot opt out of emitting it.

Request: when the effective tool set is empty, omit tools from the serialized body (or make that behavior configurable). This also makes the documented hook pattern of deleting tools from event.tools safe against strict upstreams.

Workaround we deployed: a local http.request hook plugin that deletes empty tools arrays from outgoing JSON bodies before the request leaves opencode.

Dominant language
TypeScript
Stars
221k
Forks
29.6k
Avg merge
4h 35m
Merged PRs (30d)
521

Getting set up

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.

More from anomalyco/opencode

All issues in anomalyco/opencode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.