Cause: OpenCode tries to load the plugin via the "plugin" key in config, triggering module resolution differences in Bun vs Node.js.
Fix:
- Do NOT register via
"plugin": ["opencode-rag-plugin"]in OpenCode config - Rely on
.opencode/plugins/*.jsauto-discovery instead - Run
opencode-rag initto regenerate workspace-local plugin files - Remove stale
"plugin"entries from all OpenCode config files
Verify:
node --input-type=module -e \
"const m = await import('opencode-rag-plugin'); console.log(typeof m.default, typeof m.server)"Both should be "function".
Possible causes:
- Workspace not indexed yet — run
opencode-rag index - Embedding call failing — check if the raw socket path is being used correctly (see proxy section)
- No matching code found — refine your query or run
opencode-rag indexto (re)index the workspace - Index is stale — run
opencode-rag index --forcefor a full rebuild
Symptom: Indexing fails with timeout errors.
Fix: Increase embedding.timeoutMs in opencode-rag.json. The default is 30000ms. Cold-start model loading can take longer for large models.
{
"embedding": {
"timeoutMs": 60000
}
}Symptom: @lancedb/lancedb throws errors about missing native binary or peer dependency.
Fix (end users):
npm install -g opencode-rag-pluginFix (developers of the plugin):
npm install --legacy-peer-depsEnsure apache-arrow is installed — it's a peer dependency.
Cause: Corporate proxy or SSL inspection blocking npm.
Fix:
set NODE_TLS_REJECT_UNAUTHORIZED=0 # Windows
export NODE_TLS_REJECT_UNAUTHORIZED=0 # Linux/macOS
npm install -g opencode-rag-pluginWhen running inside OpenCode, the runtime can interfere with the normal Node HTTP stack, causing localhost Ollama calls to be redirected through the proxy.
Symptoms:
- Ollama calls fail or time out
- OpenCode stops returning context
Fix: OpenCodeRAG's directRequest() in http.ts uses raw net/tls sockets for direct requests, bypassing the patched HTTP stack. Ensure you use http://127.0.0.1:11434/api (not localhost) in config for the bypass to work.
Cause: chokidar and LanceDB leave open handles.
Fix: Always use --test-force-exit:
node --import tsx --test --test-force-exit "src/**/*.test.ts"The ReadMe is generated and edited by the workflow manager. If you're editing files manually, use the Read tool first to ensure you have the current content.
Enable debug logging to diagnose issues:
{
"logging": {
"level": "debug",
"logFilePath": "./.opencode/opencode-rag.log"
}
}The log file provides detailed information about indexing, retrieval, and plugin events.
The manifest file (manifest.json) uses schema versioning. If the format changes between plugin versions, a full index rebuild is triggered automatically.
To manually force a rebuild:
opencode-rag index --forceIf the LLM description provider is unavailable or times out, affected files are automatically flagged in the manifest with descriptionFailed: true. On the next opencode-rag index run, these files are fully re-indexed (re-chunked and re-described) without requiring --force.
Symptoms:
- Logs show
Description generation failed for <chunkId>warnings opencode-rag statusshowsdescriptionFailedFiles > 0
Fix:
- Ensure the description provider is running (e.g.,
ollama serve) - Run
opencode-rag index— flagged files will be retried automatically - If the issue persists, check
description.timeoutMsanddescription.retryMaxin your config
# Test dynamic import
node --input-type=module -e \
"const m = await import('opencode-rag-plugin'); console.log(typeof m.default, typeof m.server)"
# Test require (CommonJS fallback)
node -e \
"const m = require('opencode-rag-plugin'); console.log(typeof m.default, typeof m.server)"Test whether proxy configuration is working:
# Check if HTTP_PROXY env var is set
echo $HTTP_PROXY
# Check if proxy auth header is correctly formed
# The buildProxyAuthHeader() in http.ts Base64-encodes username:password
echo -n "user:pass" | base64The watcher writes status to watcher-status.json in the store path:
cat .opencode/rag_db/watcher-status.jsonThis shows running status and lastRunAt timestamp for the background indexer.