{"record":{"id":"5c1b5c52ca85f21f","repo":"can1357/oh-my-pi","slug":"label-must-be-a-non-empty-string","errorCode":null,"errorMessage":"${label} must be a non-empty string","messagePattern":"(.+?) must be a non-empty string","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/launch/protocol.ts","lineNumber":158,"sourceCode":"\tevent: \"daemon-completed\";\n\tcompletionId: string;\n\towner: string;\n\tdaemon: DaemonSnapshot;\n}\n\nexport type DaemonWireMessage = DaemonWireResponse | DaemonCompletionNotification;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction record(value: unknown, label: string): Record<string, unknown> {\n\tif (!isRecord(value)) throw new Error(`${label} must be an object`);\n\treturn value;\n}\n\nfunction stringValue(value: unknown, label: string): string {\n\tif (typeof value !== \"string\" || value.length === 0) throw new Error(`${label} must be a non-empty string`);\n\treturn value;\n}\nfunction rawString(value: unknown, label: string): string {\n\tif (typeof value !== \"string\") throw new Error(`${label} must be a string`);\n\treturn value;\n}\n\nfunction optionalString(value: unknown, label: string): string | undefined {\n\tif (value === undefined) return undefined;\n\treturn stringValue(value, label);\n}\n\nfunction optionalRawString(value: unknown, label: string): string | undefined {\n\tif (value === undefined) return undefined;\n\treturn rawString(value, label);\n}\n\nfunction booleanValue(value: unknown, label: string): boolean {","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/launch/protocol.ts#L140-L176","documentation":"stringValue(value, label) validates that a required wire field is a non-empty string. It backs optionalString, state, policy, signal, parseDaemonSpec, and parseDaemonSnapshot — so any required string field (ids, names, state values, signals) that is missing, empty, or not a string triggers '<label> must be a non-empty string'.","triggerScenarios":"Omitting a required field in a daemon RPC (e.g. missing id/name); sending \"\" for a required string; sending a number/boolean where a string is expected in a spec or snapshot payload.","commonSituations":"Hand-built RPC payloads missing required fields; clients built against an older protocol version whose fields were renamed or made required; templates with unfilled values serialized as empty strings.","solutions":["Populate the field named in the error label with a non-empty string before sending","Validate payloads client-side with the same protocol validators before writing to the socket","Sync to matching client/broker versions and update any field renames"],"exampleFix":"// before\nsocket.write(JSON.stringify({ op: \"start\" })); // missing name\n// after\nsocket.write(JSON.stringify({ op: \"start\", name: \"dev-agent\" }));","handlingStrategy":"validation","validationCode":"const required = ['id', 'name', 'state'];\nfor (const key of required) {\n  if (typeof payload[key] !== 'string' || payload[key].length === 0) throw new Error(`${key} must be a non-empty string`);\n}","typeGuard":"function isNonEmptyString(v: unknown): v is string {\n  return typeof v === 'string' && v.length > 0;\n}","tryCatchPattern":"try {\n  const spec = parseDaemonSpec(raw);\n} catch (err) {\n  if (err.message.includes('must be a non-empty string')) {\n    logger.warn('daemon payload rejected: missing required string field', { detail: err.message });\n    return;\n  }\n  throw err;\n}","preventionTips":["Fill all required string fields before sending RPCs; never send empty strings as placeholders","Validate client-side with the same parse/validate helpers the protocol uses","Update client code when protocol fields become required or are renamed"],"tags":["ipc","wire-protocol","schema-validation","validation"],"backgroundTag":"schema-validation-failed","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}