{"record":{"id":"0d4397d65c5cfd06","repo":"diegosouzapw/OmniRoute","slug":"content-delta-text-is-invalid","errorCode":null,"errorMessage":"Content delta text is invalid","messagePattern":"Content delta text is invalid","errorType":"exception","errorClass":"ClaudeWebProtocolError","httpStatus":null,"severity":"error","filePath":"open-sse/executors/claude-web/stream.ts","lineNumber":191,"sourceCode":"  if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n    throw new ClaudeWebProtocolError(`${context} must be an object`);\n  }\n  return value as Record<string, unknown>;\n}\n\nfunction requireBlockIndex(event: Record<string, unknown>): number {\n  if (!Number.isInteger(event.index) || (event.index as number) < 0) {\n    throw new ClaudeWebProtocolError(\"Content block index is invalid\");\n  }\n  return event.index as number;\n}\n\nfunction deltaText(delta: Record<string, unknown>, fields: string[]): string {\n  for (const field of fields) {\n    const value = delta[field];\n    if (typeof value === \"string\") return value;\n  }\n  throw new ClaudeWebProtocolError(\"Content delta text is invalid\");\n}\n\nfunction thinkingSummaryText(delta: Record<string, unknown>): string {\n  if (typeof delta.summary === \"string\") return delta.summary;\n  if (delta.summary && typeof delta.summary === \"object\" && !Array.isArray(delta.summary)) {\n    return deltaText(delta.summary as Record<string, unknown>, [\"summary\", \"text\", \"thinking\"]);\n  }\n  return deltaText(delta, [\"text\", \"thinking\"]);\n}\n\ninterface ProtocolState {\n  phase: StreamPhase;\n  openBlocks: Map<number, BlockKind>;\n  toolBlocks: Map<number, ToolBlockInfo>;\n  stopReason: string;\n}\n\nfunction protocolFailure(state: ProtocolState, message: string): never {","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/open-sse/executors/claude-web/stream.ts#L173-L209","documentation":"Shape guard deltaText: none of the candidate text fields on a content_block delta (e.g. text/thinking fields per the passed field list) holds a string. The delta event arrived but carries its text payload in an unrecognized shape, so no text can be extracted for the chunk.","triggerScenarios":"Thrown at open-sse/executors/claude-web/stream.ts:191 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Log the raw delta to see which field now carries the text and extend the fields list","Emit an empty/neutral delta rather than killing the stream when only one delta is affected"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}