Skip to content

ZodError: id field must start with 'prt' on startup #18557

@czw333221

Description

@czw333221

Bug Description

OpenCode throws a ZodError after sending a message, but recovers after toggling fullscreen mode.

Error Message

schema validation failure

ZodError: {
  "origin": "string",
  "code": "invalid_format",
  "format": "starts_with",
  "prefix": "prt",
  "path": "id",
  "message": "Invalid string: must start with \"prt\""
}

Stack trace:

  • result5 at /$bunfs/root/src/cli/cmd/tui/worker.js:103962:20
  • createUserMessage at /$bunfs/root/src/cli/cmd/tui/worker.js:189832:35

Steps to Reproduce

  1. Start OpenCode in terminal
  2. Send any message
  3. Error appears immediately
  4. Toggle fullscreen (or resize terminal)
  5. Error clears and app works normally

Environment

  • OpenCode version: 1.2.27
  • Platform: Windows WSL2
  • Distro: Ubuntu 24.04.4 LTS
  • Kernel: 5.15.167.4-microsoft-standard-WSL2

Additional Context

The error appears to be related to an ID validation schema that requires id.startsWith("prt"). This might be related to:

  • Config file ID format
  • Supermemory storage record IDs
  • Session/agent ID generation
  • Conversation/message ID handling

Workaround

  • Toggling fullscreen mode clears the error
  • Resizing terminal window also helps

Suggested Fix

Either:

  1. Make the prt prefix validation more lenient or provide fallback
  2. Ensure all generated IDs include the required prefix
  3. Add better error handling/recovery for this validation failure
  4. Auto-retry or regenerate ID when validation fails

Metadata

Metadata

Assignees

Labels

opentuiThis relates to changes in v1.0, now that opencode uses opentuiwindows

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions