{"record":{"id":"d354910c6254fa85","repo":"deepseek-ai/deepseek-harness","slug":"assistant-message-event-carried-malformed-content","errorCode":null,"errorMessage":"assistant/message event carried malformed content: ${JSON.stringify(value)}","messagePattern":"assistant/message event carried malformed content: (.+?)","errorType":"exception","errorClass":"SdkProtocolError","httpStatus":null,"severity":"error","filePath":"packages/sdk/client/src/api.ts","lineNumber":218,"sourceCode":" * @returns the content blocks to send.\n */\nexport function normalizeInput(input: string | ContentBlock[]): ContentBlock[] {\n  return typeof input === 'string' ? [{ type: 'text', text: input }] : input\n}\n\n/** Validate the fields in a wire `session.event` envelope before returning the typed result. */\nfunction validatedSessionEvent(value: unknown): SessionEvent {\n  if (!isRecord(value) || typeof value.type !== 'string') {\n    throw new SdkProtocolError(`session.event carried no event envelope: ${JSON.stringify(value)}`)\n  }\n  // The one variant this module reads into (finalResponse) must carry\n  // kind-tagged content blocks; other variants pass through under their\n  // envelope shape.\n  if (value.type === 'assistant/message') {\n    const message = isRecord(value.data) ? value.data.message : undefined\n    const content = isRecord(message) ? message.content : undefined\n    if (!Array.isArray(content) || !content.every(block => isRecord(block) && typeof block.type === 'string')) {\n      throw new SdkProtocolError(`assistant/message event carried malformed content: ${JSON.stringify(value)}`)\n    }\n  }\n  return value as unknown as SessionEvent\n}\n\n/** Whether a raw session event is the durable enqueue receipt for `messageId`. */\nfunction isInboxReceipt(value: unknown, messageId: string): boolean {\n  if (!isRecord(value) || value.type !== 'agent/inbox/spliced' || !isRecord(value.data)) return false\n  const inserted = value.data.inserted\n  return Array.isArray(inserted) && inserted.some(message => isRecord(message) && message.id === messageId)\n}\n\n/**\n * Extract the concatenated text of the last assistant message.\n * @param events - the activity interval's `session.event` payloads in wire order.\n * @returns the final response text, or `''` when no assistant message exists.\n */\nexport function finalResponse(events: SessionEvent[]): string {","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/sdk/client/src/api.ts#L200-L236","documentation":"Error \"assistant/message event carried malformed content: ${JSON.stringify(value)}\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/sdk/client/src/api.ts:218 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the server emits well-formed assistant/message content blocks; align SDK and server versions."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}