Repository navigation
Bash(ls -la) tool description parameter is required but not exposed in tool schema — breaks all bash calls #13146
Description
Description
$ ls -la
Error: The bash tool was called with invalid arguments: [
{
"expected": "string",
"code": "invalid_type",
"path": [
"description"
],
"message": "Invalid input: expected string, received undefined"
}
].
Please rewrite the input so it satisfies the expected schema.
Summary
The built-in bash tool has a hidden required parameter description that is not included in the tool schema exposed to the AI model. This causes every single bash command to fail with a Zod validation error, including basic operations like ls -la.
This is a critical/blocking bug — the bash tool is completely unusable until the user discovers and works around this issue.
Severity
Critical / P0 — The bash tool is one of the most fundamental tools. When it doesn't work, the AI agent cannot run any shell commands (git, npm, build, test, etc.), severely crippling its capabilities.
Environment
- opencode version: 1.1.56
- OS: macOS Darwin 24.5.0 (arm64, Apple Silicon)
- Node.js: v20.19.5
- Plugin:
oh-my-opencode@latest - Binary:
/opt/homebrew/lib/node_modules/opencode-ai/node_modules/opencode-darwin-arm64/bin/opencode
Steps to Reproduce
- Start an opencode session
- Ask the AI to run any bash command, e.g.
ls -la - The AI calls the bash tool with the documented parameters:
{ "command": "ls -la" } - Immediate failure with:
{ "expected": "string", "code": "invalid_type", "path": ["description"], "message": "Invalid input: expected string, received undefined" }
Expected Behavior
bash(command="ls -la") should execute successfully and return directory listing.
Actual Behavior
Every bash call fails with a Zod schema validation error because description is required but the AI doesn't know it needs to pass it.
Root Cause Analysis
Found by extracting the tool definition from the compiled binary:
strings /opt/homebrew/lib/node_modules/opencode-ai/node_modules/opencode-darwin-arm64/bin/opencode \
| grep -A20 'The command to execute'
The bash tool's parameter schema is defined as:
parameters: zod_default.object({
command: zod_default.string().describe("The command to execute"),
timeout: zod_default.number().describe("Optional timeout in milliseconds").optional(),
workdir: zod_default.string().describe("...").optional(),
description: zod_default.string().describe("Clear, concise description of what this command does in 5-10 words...")
// ↑↑↑ NOT marked as .optional() — Zod treats it as REQUIRED
})The problem: description is defined as a required string() — it lacks .optional(). However, the tool schema exposed to the AI model does not include description as a visible/documented parameter. The AI has no way to know it must pass this field.
Proposed Fix
Option A (Recommended): Make description optional:
- description: zod_default.string().describe("...")
+ description: zod_default.string().describe("...").optional()Option B: Include description in the tool schema that is exposed to the AI model, so the model knows to pass it.
Current Workaround
Add the following to user-level instructions (~/.claude/CLAUDE.md or equivalent):
# Bash Tool: `description` parameter is required
When calling the `bash` tool, you MUST pass a `description` parameter (5-10 words describing the command), otherwise you'll get a schema validation error.
✅ bash(command="ls -la", description="List current directory files")
❌ bash(command="ls -la") ← will error with "description" invalid_type
### Plugins
oh-my-opencode
### OpenCode version
1.1.56
### Steps to reproduce
/init
### Screenshot and/or share link
<img width="2394" height="1802" alt="Image" src="https://github.com/user-attachments/assets/f594826a-65b6-48b1-abb9-25a7ba607205" />
### Operating System
macOS 15.5
### Terminal
iTerm2
Activity
daheli commentedon Feb 11, 2026
rekram1-node commentedon Feb 11, 2026
What provider are you using?
This is the schema of the tool:
And this is not a "hidden field"
Most likely your provider or model is confused or not great and perhaps we need to tweak to make it perform better
allarac commentedon Feb 13, 2026
@rekram1-node These kind of issues happen with pretty much every model if you use ollama.
For example glm-4.7-flash. And this model at least does something, most other models seem to be completely incompatible with all kinds of agents, including opencode.
fix(bash): make description parameter optional in bash tool
xochilpili commentedon Feb 25, 2026
Any update on this? Is entirely annoying!
mszepieniec commentedon Mar 4, 2026
FWIW I'm seeing this a lot using qwen3-coder-next through AWS Bedrock and LiteLLM.
Maybe it would help if the description property would be moved ahead of the optional properties, and/or explicitly mentioning the fact that it's required in the property's description?
fix: make bash tool description parameter optional
fix(opencode): add critical tool schema rules
github-actions commentedon Jul 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
fix(opencode): resolve MCP env placeholders and unbreak the bash tool…