Plugin v1.7.1 silently crashes on startup with opencode 1.14.48, causing AI to be completely unresponsive
Description
opencode-claude-memory v1.7.1 silently crashes on startup when used with opencode v1.14.48 (Windows). The AI becomes completely unresponsive and the session terminates immediately with no error message visible to the user.
Workaround: Set OPENCODE_MEMORY_IGNORE=1 environment variable to bypass the plugin.
Root Cause
Two issues compounding each other:
1. Incompatible API check in isSupportedRecallSelectorClient
recallSelector.js checks session.prompt.length >= 2:
function isSupportedRecallSelectorClient(session) {
return typeof session?.prompt?.length === 'number' && session.prompt.length >= 2;
}
However, opencode 1.14.48's session.prompt has the signature (message: string) => SDKPromise<...> (accepts 1 argument), so session.prompt.length is 1, which fails the >= 2 check. This causes assertSupportedRecallSelectorClient to throw.
2. No try/catch protection in any hook path
v1.7.1 calls assertSupportedRecallSelectorClient(session) directly inside startRecallPrefetch (which throws), instead of using isSupportedRecallSelectorClient (which returns false). The exception propagates through 3 nested hooks, none of which have try/catch:
experimental.chat.messages.transform
experimental.chat.system.transform
MemoryPlugin initialization
A single unhandled exception in any of these hooks kills the entire opencode process with no user-visible feedback.
Fix (verified locally)
recallSelector.js:
isSupportedRecallSelectorClient: Remove the .length check, change to typeof session?.prompt === 'function'
index.js:
startRecallPrefetch: Wrap in try/catch, log error only instead of throwing
messages.transform: Add Array.isArray guard on messages + try/catch
system.transform: Wrap in try/catch
MemoryPlugin init: Wrap getMemoryDir in try/catch
config hook: Return a new object to prevent frozen object issue
paths.js: Wrap getMemoryDir/ensureDir in try/catch
prompt.js: Wrap buildMemorySystemPrompt in try/catch
Environment
- opencode: v1.14.48
- opencode-claude-memory: v1.7.1 (note: opencode loads plugins from
~/.cache/opencode/packages/ cache, not from npm global — the npm global v1.7.2 may not trigger this)
- OS: Windows
- Plugin loaded from:
~/.cache/opencode/packages/opencode-claude-memory@latest/node_modules/opencode-claude-memory/dist/
Relevant Log Output (run with --log-level DEBUG)
opencode-claude-memory LLM recall requires an OpenCode SDK with structured output session.prompt support
at assertSupportedRecallSelectorClient (recallSelector.js:...)
at startRecallPrefetch (index.js:...)
Plugin v1.7.1 silently crashes on startup with opencode 1.14.48, causing AI to be completely unresponsive
Description
opencode-claude-memory v1.7.1 silently crashes on startup when used with opencode v1.14.48 (Windows). The AI becomes completely unresponsive and the session terminates immediately with no error message visible to the user.
Workaround: Set
OPENCODE_MEMORY_IGNORE=1environment variable to bypass the plugin.Root Cause
Two issues compounding each other:
1. Incompatible API check in
isSupportedRecallSelectorClientrecallSelector.jscheckssession.prompt.length >= 2:However, opencode 1.14.48's
session.prompthas the signature(message: string) => SDKPromise<...>(accepts 1 argument), sosession.prompt.lengthis1, which fails the>= 2check. This causesassertSupportedRecallSelectorClientto throw.2. No try/catch protection in any hook path
v1.7.1 calls
assertSupportedRecallSelectorClient(session)directly insidestartRecallPrefetch(which throws), instead of usingisSupportedRecallSelectorClient(which returns false). The exception propagates through 3 nested hooks, none of which have try/catch:experimental.chat.messages.transformexperimental.chat.system.transformMemoryPlugininitializationA single unhandled exception in any of these hooks kills the entire opencode process with no user-visible feedback.
Fix (verified locally)
recallSelector.js:
isSupportedRecallSelectorClient: Remove the.lengthcheck, change totypeof session?.prompt === 'function'index.js:
startRecallPrefetch: Wrap in try/catch, log error only instead of throwingmessages.transform: AddArray.isArrayguard on messages + try/catchsystem.transform: Wrap in try/catchMemoryPlugininit: WrapgetMemoryDirin try/catchconfig hook: Return a new object to prevent frozen object issuepaths.js: Wrap
getMemoryDir/ensureDirin try/catchprompt.js: Wrap
buildMemorySystemPromptin try/catchEnvironment
~/.cache/opencode/packages/cache, not from npm global — the npm global v1.7.2 may not trigger this)~/.cache/opencode/packages/opencode-claude-memory@latest/node_modules/opencode-claude-memory/dist/Relevant Log Output (run with
--log-level DEBUG)