Skip to content

ZodError: Part IDs missing 'prt' prefix in chat.message hook #32

@putueddy

Description

@putueddy

Bug

OpenCode v1.2.27 validates that all part IDs must start with "prt" prefix. The chat.message hook in opencode-supermemory creates parts with IDs that don't have this prefix, causing a ZodError on every user message submission.

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:189861:35)

Root Cause

In dist/index.js, the chat.message hook creates two parts with non-compliant IDs:

  1. Line ~14548 (nudge part):

    id: `supermemory-nudge-${Date.now()}`,
  2. Line ~14582 (context part):

    id: `supermemory-context-${Date.now()}`,

Both are pushed/unshifted into output.parts, which OpenCode then validates with a Zod schema requiring id to start with "prt".

Fix

Prefix the IDs with prt_:

id: `prt_supermemory-nudge-${Date.now()}`,
id: `prt_supermemory-context-${Date.now()}`,

Environment

  • OpenCode: v1.2.27
  • opencode-supermemory: v2.0.4
  • macOS (arm64)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions