#2558·MiMo-Code

Fatal TUI crash: non-string tool-call path throws "The ""path"" property must be of type string" and destroys the session view

Author: abdoosh100Created Sep 28, 2026Updated Sep 28, 2026

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:

typescript
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:

typescript
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 — normalizePath used by Glob, Grep, Read, Write, Edit, ViewImage
  • index.tsx — filetype() (uses path.extname, throws identically)
  • index.tsx — Bash workdir → path.resolve(base, workdir)
  • permission.tsx — a second, divergent copy of normalizePath / filetype
  • cli/cmd/run.ts — a third copy, in the headless mimo run renderer. That path has no ErrorBoundary at 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 in InvalidOutputError
  • #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:

  1. bun install
  2. bun test test/cli/tui/tool-input-path-guard.test.ts from packages/opencode
  3. 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