Fatal TUI crash: non-string tool-call path throws "The ""path"" property must be of type string" and destroys the session view
Description
A single non-string path / file_path field in a tool call takes down the entire TUI. The session view is replaced by the ErrorComponent fatal screen ("A fatal error occurred!"), and the only way out is Ctrl+C — which ends the session.
Error message
TypeError: The "path" property must be of type string, got object
at isAbsolute (unknown)
... (through internal render functions)Root cause
The tool-call renderers read the raw, unvalidated model payload. In
packages/opencode/src/cli/cmd/tui/routes/session/index.tsx the props are built as:
get input() {
return props.part.state.input ?? {}
}state.input is whatever the model emitted. The tool's zod schema
(packages/opencode/src/tool/glob.ts → path: z.string().optional()) is only applied
inside the tool's execute(), never on the render path. So a payload where path is
an object instead of a string reaches:
function normalizePath(input?: string) {
if (!input) return "" // only guards nullish
const absolute = path.isAbsolute(input) ? ... // throws on non-string?? {} / !input guard null and undefined but not other types, and an object is
truthy. path.isAbsolute({}) throws, and because there is no ErrorBoundary inside the
session route, the top-level one in app.tsx catches it and ErrorComponent replaces
the whole transcript.
Why it is Bun-specific
The wording differs per runtime, and only the Bun build produces the message above:
| Runtime | Message |
|---|---|
| Bun 1.3.14 (shipped build) | The "path" property must be of type string, got object |
| Node 24 | The "path" argument must be of type string. Received an instance of Object |
So this is invisible under Node and only bites the compiled --compile binary.
Affected call sites (all pass raw state.input straight through):
index.tsx—normalizePathused by Glob, Grep, Read, Write, Edit, ViewImageindex.tsx—filetype()(usespath.extname, throws identically)index.tsx— Bashworkdir→path.resolve(base, workdir)permission.tsx— a second, divergent copy ofnormalizePath/filetypecli/cmd/run.ts— a third copy, in the headlessmimo runrenderer. That path has noErrorBoundaryat all, so a malformed field simply aborts the run.
Note that permission.tsx already sanitizes at its call sites
(typeof meta["filepath"] === "string" ? ... : undefined), so the guard is an existing
convention in this codebase that index.tsx and run.ts simply omit.
Suspected trigger (not confirmed)
I could not determine what makes the model emit a non-string path. Two related reports
suggest malformed tool-arg shapes reaching the harness:
- #2498 — model degeneration emitting stringified JSON tool args, e.g.
grep { "path": "...", "pattern": "..." }, ending inInvalidOutputError - #2394 / PR #673 — "lifted, duplicated, stringified keys" needing arg recovery before zod
Treating the renderer as untrusted-input-safe is worthwhile regardless of that root cause.
Expected behavior
A malformed tool-call field should degrade to an empty label on that one tool line, not destroy the session view.
Plugins
No response
MiMoCode version
0.1.15 (also reproduced on 0.1.14)
Steps to reproduce
Deterministic, via a unit test — no reliance on model behaviour:
bun installbun test test/cli/tui/tool-input-path-guard.test.tsfrompackages/opencode- Before the fix: failures in all three helper copies, each
TypeError: The "path" property must be of type string, got object/got array
In the wild, it surfaces when viewing a subagent (Ctrl+X) or when a subagent's tool call
is rendered and that tool call carries a non-string path.
Screenshot and/or share link
No response
Operating System
Windows 11 (x64)
Terminal
PowerShell / Windows Terminal
Source: XiaomiMiMo/MiMo-Code