Bug
OpenCode now validates message part IDs with a Zod schema requiring them to start with "prt". The chat.message hook creates parts with IDs like supermemory-context-{timestamp} and supermemory-nudge-{timestamp}, which fail validation.
Error
ZodError: [
{
"origin": "string",
"code": "invalid_format",
"format": "starts_with",
"prefix": "prt",
"path": ["id"],
"message": "Invalid string: must start with \"prt\""
}
]
at createUserMessage (/$bunfs/root/src/cli/cmd/tui/worker.js:108:35)
Reproduction
- Install
opencode-supermemory@2.0.4
- Send the first message in a new session
- Error fires on every first message (when context injection runs)
Root Cause
In dist/index.js, the chat.message hook creates parts with non-compliant IDs:
- Line ~14548:
id: \supermemory-nudge-${Date.now()}``
- Line ~14582:
id: \supermemory-context-${Date.now()}``
Meanwhile, generatePartId() (line ~14180) already generates correct prt_-prefixed IDs but is only used in injectHookMessage.
Fix
Use the prt_ prefix for all part IDs in the chat.message hook, e.g.:
id: `prt_supermemory-nudge-${Date.now()}`
id: `prt_supermemory-context-${Date.now()}`
Or reuse the existing generatePartId() function.
Environment
- opencode-supermemory: 2.0.4
- OpenCode: latest (bunfs-based CLI)
Bug
OpenCode now validates message part IDs with a Zod schema requiring them to start with
"prt". Thechat.messagehook creates parts with IDs likesupermemory-context-{timestamp}andsupermemory-nudge-{timestamp}, which fail validation.Error
Reproduction
opencode-supermemory@2.0.4Root Cause
In
dist/index.js, thechat.messagehook creates parts with non-compliant IDs:id: \supermemory-nudge-${Date.now()}``id: \supermemory-context-${Date.now()}``Meanwhile,
generatePartId()(line ~14180) already generates correctprt_-prefixed IDs but is only used ininjectHookMessage.Fix
Use the
prt_prefix for all part IDs in thechat.messagehook, e.g.:Or reuse the existing
generatePartId()function.Environment