{"record":{"id":"4c4739a24e634c2a","repo":"moeru-ai/airi","slug":"unsupported-responses-output-item-item-type","errorCode":null,"errorMessage":"Unsupported Responses output item: ${item.type}","messagePattern":"Unsupported Responses output item: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core-agent/src/runtime/responses.ts","lineNumber":148,"sourceCode":"    if (item.type === 'function_call_output')\n      return [{ id, role: 'tool', segments: [{ type: 'tool-result', callId: item.call_id, content: readToolResultContent(item.output) }] }]\n    if (item.type === 'message' && item.role === 'assistant') {\n      const segments: Extract<ProjectionEntry, { role: 'assistant' }>['segments'] = typeof item.content === 'string'\n        ? [{ type: 'text', text: item.content }]\n        : item.content.map((part) => {\n            if (part.type === 'output_text')\n              return { type: 'text', text: part.text, citations: readCitations(part) }\n            if (part.type === 'refusal')\n              return { type: 'refusal', text: part.refusal }\n            throw new Error('Unsupported Responses assistant content')\n          })\n      return [{ id, role: 'assistant', segments }]\n    }\n    // These native records have no portable message content. Search citations\n    // already belong to the assistant text; opaque state stays in continuation.\n    if (item.type === 'reasoning' || item.type === 'compaction' || item.type === 'web_search_call')\n      return []\n    throw new Error(`Unsupported Responses output item: ${item.type}`)\n  })\n}\n\nfunction toolChoice(choice: StreamOptions['toolChoice']): ResponsesOptions['toolChoice'] {\n  if (choice == null || typeof choice === 'string')\n    return choice\n  if (choice.type === 'function')\n    return { type: 'function', name: choice.function.name }\n  return { type: 'allowed_tools', mode: choice.mode, tools: choice.tools.map(tool => ({ type: 'function', name: tool.function.name })) }\n}\n\n/**\n * Projects context directly into Responses and runs stateless tool steps.\n * Only a fully settled generation produces a generated turn for the caller to commit.\n */\nexport function streamResponses(input: {\n  config: ResponsesConfig\n  webSearch?: boolean","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/moeru-ai/airi/blob/438a067dde47aa0bdb46c2323d1fe293dc805218/packages/core-agent/src/runtime/responses.ts#L130-L166","documentation":"readOutput maps each ItemParam in a Responses output array to a projection entry. Known item types (function_call, function_call_output, assistant message) are converted; reasoning, compaction, and web_search_call are intentionally skipped; anything else throws. This is a catch-all for unknown native Responses output item types the portable model cannot represent.","triggerScenarios":"generation() -> readOutput() receives an item whose type is not one of function_call, function_call_output, message/assistant, reasoning, compaction, or web_search_call — e.g. 'image_generation_call', 'code_interpreter_call', 'mcp_call', or a typo'd/unknown item type from the Responses API.","commonSituations":"Enabling new Responses API features (built-in tools that emit their own output item types) on a model whose adapter predates those types; replaying stored continuation data containing item types from a newer API; constructing ItemParam arrays manually with the wrong type string.","solutions":["Check the item.type value in the failing response; disable or avoid the Responses feature/tool that produced the unsupported item type.","Upgrade core-agent's Responses adapter to a version that skips or maps the new item type.","As a workaround, pre-filter the items array before projection to drop unknown item types.","File an upstream issue to add the item type to the skip list (alongside reasoning/compaction/web_search_call)."],"exampleFix":"// before\nconst items = response.output\n\n// after\nconst known = ['function_call', 'function_call_output', 'message', 'reasoning', 'compaction', 'web_search_call']\nconst items = response.output.filter(i => known.includes(i.type))","handlingStrategy":"try-catch","validationCode":"const KNOWN_ITEMS = new Set(['function_call', 'function_call_output', 'message', 'reasoning', 'compaction', 'web_search_call'])\nconst unknown = response.output.filter(i => !KNOWN_ITEMS.has(i.type))\nif (unknown.length) console.warn('dropping unsupported output items:', unknown.map(i => i.type))","typeGuard":"function isProjectableOutputItem(item) {\n  return ['function_call', 'function_call_output', 'message', 'reasoning', 'compaction', 'web_search_call'].includes(item?.type)\n}","tryCatchPattern":"try {\n  entries = readOutput(items)\n} catch (err) {\n  const m = /^Unsupported Responses output item: (.+)$/.exec(err.message)\n  if (m) {\n    console.error(`Responses item type '${m[1]}' is not supported; disable that feature or upgrade the adapter.`)\n  } else throw err\n}","preventionTips":["Only enable Responses built-in tools whose output item types the adapter supports.","Wrap readOutput in a filter that drops unknown item types when forward compatibility matters.","Update the skip list whenever the upstream API adds item types you intend to use."],"tags":["unexpected-response-shape","responses-api","output-item"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"438a067dde47aa0bdb46c2323d1fe293dc805218","analyzedAt":"2026-09-17T01:14:42.644Z","contentChangedAt":"2026-09-17T01:14:42.644Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}