MiMo-Code icon indicating copy to clipboard operation
MiMo-Code copied to clipboard

v0.1.0: All tools fail with 'undefined is not an object (evaluating J.replace)'

Open aganwkh opened this issue 5 months ago • 0 comments

Environment:

  • OS: Windows 11 Pro (10.0.26100)
  • MiMo Code version: v0.1.0 (mimo.exe, Bun-compiled PE32+ binary)
  • Provider: xiaomi (https://token-plan-cn.xiaomimimo.com/v1)
  • Model: mimo-v2.5-pro
  • Shell: PowerShell

Bug description: All tool calls (bash, read, write, glob, grep, etc.) fail with the same JavaScript error:

undefined is not an object (evaluating 'J.replace')

Where J is a minified variable name in the compiled binary. This happens on EVERY tool, regardless of the tool type or arguments.

Steps to reproduce:

  1. Launch mimo.exe on Windows
  2. Login with xiaomi provider account
  3. Send any message that triggers a tool call (e.g., 'list files in current directory')
  4. All tools return the same error

Error output from TUI:

$ dir
+ Error (1 line)
→ Read .
+ Error (1 line)

The model itself observes: '所有工具都出现相同的JavaScript错误 (undefined is not an object (evaluating J.replace'))'

Analysis:

  • The error is NOT in the backend logs (no TypeError logged) — it's in the Bun-compiled JavaScript execution layer
  • The J variable is a minified name that should hold a string but is undefined
  • The error occurs in the common tool execution path, before the specific tool logic runs
  • Likely location: tool description template expansion in packages/opencode/src/tool/bash.ts (lines 626-631, .replaceAll() chain) or packages/opencode/src/tool/shell-wrap.ts (escapeAttr function), where a template variable resolves to undefined
  • The user's config at ~/.mimocode/config.json previously had stale ollama settings (runtime/endpoint/model) which have been cleaned, but the error persists — confirming this is a code bug, not a config issue

Additional context:

  • MCP servers (playwright, chrome-devtools, danbooru, codegraph) connect successfully
  • The auth.json correctly shows xiaomi provider with valid API key
  • model.json correctly shows mimo-v2.5-pro as the active model

aganwkh avatar Jun 13 '26 03:06 aganwkh