#18392 · @danielcherubini · opened Mar 20, 2026 at 1:19 PM UTC · last updated Mar 21, 2026 at 10:12 AM UTC
fix: make bash tool description parameter optional
Score breakdown
Impact
Clarity
Urgency
Ease Of Review
Guidelines
Readiness
Size
Trust
Traction
Summary
This PR makes the "description" parameter optional for the "bash" tool, preventing critical failures when AI models omit it. It addresses a core usability blocker and infinite loop scenarios with various models, particularly smaller ones.
Description
Issue for this PR
Closes #13146
Also:
- #17415 — same error, Ubuntu
- #14519 — both command and description undefined, Windows
- #10213 — same error
- #5662 — shell hangs with "undefined"
Related (local/small model tool schema issues):
- #6649 — local model tool call parsing
- #6918 — Qwen3-Coder edit tool fails
- #18131 — Qwen 3.5 35B write tool fails
- #16488 — Qwen 3 vLLM silent crash
Type of change
- [x] Bug fix
- [ ] New feature
- [ ] Refactor / code improvement
- [ ] Documentation
What does this PR do?
The description parameter on the bash tool is required but some models (especially smaller/local models) don't always include it in tool calls, causing "Invalid input: expected string, received undefined" errors that loop indefinitely. Make it optional and fall back to the command string when not provided.
If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!
How did you verify your code works?
I ran opencode in two different repos, using small and larger models and found no issue with the error I have seen in issue #13146
Screenshots / recordings
<img width="961" height="1157" alt="image" src="https://github.com/user-attachments/assets/8532dc33-dfa3-4f9f-bee7-e677172a0f65" /> <img width="1111" height="1157" alt="image" src="https://github.com/user-attachments/assets/3fa5409e-19e5-440a-aae7-0894f9cab4db" />Checklist
- [x] I have tested my changes locally
- [x] I have not included unrelated changes in this PR
If you do not follow this template your PR will be automatically rejected.
Linked Issues
#13146 Bash(ls -la) tool `description` parameter is required but not exposed in tool schema — breaks all bash calls
View issueComments
No comments.
Changed Files
packages/opencode/src/tool/bash.ts
+7−5