You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using opencode run --session <external-id>, the Zod schema validation requires session IDs to start with ses. This blocks external orchestrators that manage session IDs in their own format (e.g. catagent-*, custom UUIDs, etc.) from passing session IDs via the --session flag.
Error observed in opencode stderr:
ERROR service=server error=Expected a string starting with "ses", got "catagent-1780062945254-girppr"
This is structurally the same class of problem as #21745 and #29868 — the Zod validation starts_with("ses") on session ID — but the trigger path is different: here it's the --session CLI flag receiving a perfectly valid string from an external tool, not an internal dispatch bug.
Steps to Reproduce
Run opencode with any well-formed string that doesn't start with ses:
echo"hello"| opencode run --format json -m deepseek/deepseek-chat -s "my-custom-session-id"
The --session CLI flag should accept any valid string as a session identifier. OpenCode should either:
Option A: Relax the Zod schema to accept arbitrary session ID strings on the --session CLI path (while keeping stricter validation for internal API routes if needed)
Option B: If --session is only intended for internal opencode-generated IDs, then the CLI should surface a clear error message (e.g. "Session not found: ") with a non-zero exit code, rather than a raw Zod validation error
Actual Behavior
The Zod schema validation starts_with("ses") rejects the input before any session lookup occurs, producing a raw validation error that is indistinguishable from other Zod failures.
The starts_with("ses") Zod constraint appears to be a recurring friction point for any code path that passes a session ID that didn't originate from opencode's own session factory
Bug Description
When using
opencode run --session <external-id>, the Zod schema validation requires session IDs to start withses. This blocks external orchestrators that manage session IDs in their own format (e.g.catagent-*, custom UUIDs, etc.) from passing session IDs via the--sessionflag.Error observed in opencode stderr:
This is structurally the same class of problem as #21745 and #29868 — the Zod validation
starts_with("ses")on session ID — but the trigger path is different: here it's the--sessionCLI flag receiving a perfectly valid string from an external tool, not an internal dispatch bug.Steps to Reproduce
ses:Expected Behavior
The
--sessionCLI flag should accept any valid string as a session identifier. OpenCode should either:--sessionCLI path (while keeping stricter validation for internal API routes if needed)--sessionis only intended for internal opencode-generated IDs, then the CLI should surface a clear error message (e.g. "Session not found: ") with a non-zero exit code, rather than a raw Zod validation errorActual Behavior
The Zod schema validation
starts_with("ses")rejects the input before any session lookup occurs, producing a raw validation error that is indistinguishable from other Zod failures.Environment
--sessionAdditional Context
starts_with("ses")Zod constraint appears to be a recurring friction point for any code path that passes a session ID that didn't originate from opencode's own session factory