Skip to content

code mode: search() discovery function missing, execute reports Unknown tool search #48912

Closed as not planned

Description

@sabandijabot

Summary

The Code Mode catalog instructs the agent to call a search(...) function inside execute to discover additional callable tools and their signatures. In this build, search is not registered in the Code Mode runtime, so every call fails with Unknown tool 'search'. The documented tool-discovery flow is unusable; agents must fall back to hard-coded catalog paths.

Environment

  • opencode version: 1.18.30 (opencode-ai npm global; harness runtime snapshot also reports 0.0.0-beta-19242, beta channel)
  • OS: Windows_NT 10.0.19045 (win32 x64)
  • Terminal: Orca (TERM=xterm-256color, TERM_PROGRAM=Orca, COLORTERM=truecolor)
  • Shell: cmd.exe host, session commands run via PowerShell
  • Install/channel: npm global (release) + legacy @opencode-ai/cli@0.0.0-beta-19242 also present
  • Active plugins: directory-based ~/.config/opencode/plugins/ → engram.ts, caveman-native.js, herdr-agent-state.js; MCP servers: engram (engram.exe mcp), caveman

Reproduction

  1. Start a session with Code Mode enabled (execute tool available).
  2. Inside execute, call the documented discovery function, e.g.:
    const r = await search({ query: "mem_judge", limit: 5 });
    return r;
  3. Observe the error (happened twice in a row, both attempts failed identically).

Expected Behavior

search(input: { query, namespace?, limit?, offset? }) should return matching catalog entries (path, description, signature) so the agent can resolve tool paths/signatures not shown in the partial catalog.

Actual Behavior

Unknown tool 'search'.
The tool may have been removed or renamed. Use search to find available tools.

The error message itself references search as the remedy, which makes the failure a dead end (the suggested tool is the one that is missing).

Additional Context

  • Frequency: consistently reproducible within the session (2/2 attempts).
  • Impact: low severity — workaround exists: call documented catalog paths directly (e.g. tools.engram.mem_save(...)). But any flow that depends on discovering tool signatures beyond the visible catalog is blocked. In our case the agent could not locate the mem_judge tool of the engram MCP server to resolve conflict candidates after mem_save.
  • The Code Mode system prompt/catalog explicitly documents search(...) as callable, so docs and runtime disagree.

Activity

  1. github-actions commented on Sep 14, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of an existing issue. Please check:

  2. opencode-agent commented on Sep 14, 2026

    @opencode-agent
    Contributor

    Thanks for the report. We can't reproduce this as described because the version, invocation, and error do not line up with the shipped runtimes:

    • In OpenCode 1.18.30's experimental Code Mode, discovery is exposed as tools.$codemode.search(...). Calling bare search(...) there would fail as an unknown identifier, not as Unknown tool 'search'.
    • In OpenCode V2, discovery is the bare built-in search(...). The exact error quoted here is what V2 returns when tools.search(...) is called instead.

    So the reported bare search(...) snippet and the quoted error cannot originate from the same official runtime described in the environment. The environment also lists both the 1.18.30 release and a 0.0.0-beta-19242 runtime snapshot, which suggests the CLI, background service, harness, or captured invocation may be coming from different installations.

    Closing as can't reproduce. If this still occurs, please provide the raw execute input and complete output, together with the version reported by the process/background service actually handling that session. That would let us identify which runtime is executing the call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions