You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tool files that fail to load crash the whole session/registry instead of being skipped #42250
Title: Tool files that fail to load crash the whole session/registry instead of being skipped
Problem
When a project has a .opencode/tool/*.{js,ts} file that fails to load (for example, it imports a package that couldn't be installed), the failure dies the entire tool registry — and with it, every session run in that project. A single bad tool file makes the project unusable.
The tool registry in packages/opencode/src/tool/registry.ts globs {tool,tools}/*.{js,ts} and dynamically import()s each file (line ~195) with no error handling around the import. If the file throws (e.g. ResolveMessage: Cannot find package ...), the defect propagates and kills the registry's state effect, so the whole run fails. Any valid tool files in the same project never get a chance to load.
Open that project in the web UI and send any prompt.
Observed: the whole run dies with the ResolveMessage stack instead of answering.
Expected
A failing tool file should be skipped with a warning (log + UI), and the rest of the tool registry (including valid sibling tool files) should still load so the session can proceed.
Root cause
packages/opencode/src/tool/registry.ts — the import() inside the registry state builder has no try/catch; a single failing file dies the registry.
Notes
I hit this using headless opencode via the web browser (the opencode serve API driven from a browser session); I did not test or investigate the TUI.
The trigger here (an auto-installed tool dependency failing to resolve) is separate from the module-resolution mechanism itself; a missing/uninstallable package in any tool file reproduces it.
Related: this is the repro used to hit the silently-dropped error in the companion issue about session run defects.
This issue might be a duplicate of existing issues. Please check:
Broken workspace custom tool can prevent session startup #37317: Broken workspace custom tool can prevent session startup — describes the same failure mode: a single broken custom tool file in .opencode/tool/ propagating an uncaught import error that kills tool-registry/session initialization, with the same expected fix (error boundary around each discovered custom-tool import, log a warning, skip the failing file, continue loading the rest).
Activity
github-actions commentedon Aug 13, 2026
This issue might be a duplicate of existing issues. Please check:
.opencode/tool/propagating an uncaught import error that kills tool-registry/session initialization, with the same expected fix (error boundary around each discovered custom-tool import, log a warning, skip the failing file, continue loading the rest).DatScreamer commentedon Aug 13, 2026
Note: the UI warning surfacing (warning card) ships in PR #42253; this issue is fixed by the registry skip in PR #42252.
DatScreamer commentedon Aug 13, 2026
This issue was accidentally created by the agent harness bot instead of a human account and cannot be edited/deleted from here.
The correct issue (authored by the reporter) is #42258 — please close or ignore this one: #42258
github-actions commentedon Oct 13, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.