anomalyco / anomalyco/opencode

Custom tools in .opencode/tool that import .txt descriptions fail at runtime: ERR_UNKNOWN_FILE_EXTENSION

Open
#48,112 0 comments 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Sep 9, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Summary

Custom tools placed in .opencode/tool/*.ts that import a .txt description file fail at runtime with ERR_UNKNOWN_FILE_EXTENSION, breaking every prompt in the session (the error fires before the request reaches the model).

Repro

The repo itself ships two custom tools that do this:

  • .opencode/tool/github-triage.tsimport DESCRIPTION from "./github-triage.txt"
  • .opencode/tool/github-pr-search.tsimport DESCRIPTION from "./github-pr-search.txt"

With those files present, any chat in the repo fails with:

prompt_async failed: TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".txt" for C:\work\opencode\.opencode\tool\github-triage.txt

Root cause

Built-in tools do the same import (packages/opencode/src/tool/glob.tsimport DESCRIPTION from "./glob.txt"), but those are compiled by the build toolchain, which inlines the .txt. Custom tools in .opencode/tool/ are loaded at runtime via dynamic import() in packages/opencode/src/tool/registry.ts (line 46), and the runtime cannot resolve .txt imports → the whole prompt fails.

Workaround

Inline the description as a string constant in the .ts file and drop the .txt import (verified working locally).

Suggested fix

Either:

  1. Document that custom tools must inline descriptions (and fix the repo's own two tools), or
  2. Make the runtime loader support .txt imports for custom tools (e.g., a loader hook that reads the file as text), matching what the build does for built-in tools.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.