{"record":{"id":"873c1967b1c49852","repo":"diegosouzapw/OmniRoute","slug":"kimi-web-does-not-support-tool-result-messages","errorCode":null,"errorMessage":"Kimi Web does not support tool result messages","messagePattern":"Kimi Web does not support tool result messages","errorType":"validation","errorClass":"Error","httpStatus":400,"severity":"error","filePath":"open-sse/executors/kimi-web.ts","lineNumber":239,"sourceCode":"      if (\n        (record.type === \"text\" || record.type === \"input_text\") &&\n        typeof record.text === \"string\"\n      ) {\n        return record.text;\n      }\n      throw new Error(\"Kimi Web does not support image, audio, file, or tool content\");\n    })\n    .join(\"\");\n}\n\n/** Fold text-only OpenAI history into the single user turn accepted by Kimi Web. */\nexport function foldMessages(messages: KimiWebInputMessage[]): FoldedKimiWebMessages {\n  const systemParts: string[] = [];\n  const conversationParts: string[] = [];\n\n  for (const message of messages) {\n    if (message.role === \"tool\" || message.role === \"function\") {\n      throw new Error(\"Kimi Web does not support tool result messages\");\n    }\n    if (message.tool_calls !== undefined) {\n      throw new Error(\"Kimi Web does not support assistant tool calls\");\n    }\n\n    const text = textFromContent(message.content);\n    if (message.role === \"system\" || message.role === \"developer\") {\n      if (text) systemParts.push(text);\n    } else if (message.role === \"user\") {\n      if (text) conversationParts.push(conversationParts.length > 0 ? `User: ${text}` : text);\n    } else if (message.role === \"assistant\") {\n      if (text) conversationParts.push(`Assistant: ${text}`);\n    } else {\n      throw new Error(`Kimi Web does not support message role ${message.role}`);\n    }\n  }\n\n  return {","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/open-sse/executors/kimi-web.ts#L221-L257","documentation":"Capability validation in foldMessages: a message with role 'tool' or 'function' (tool result) was found while folding history into Kimi's single user turn. Tool-result messages cannot be represented, so the fold aborts.","triggerScenarios":"Thrown at open-sse/executors/kimi-web.ts:239 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Return a 400: tool result messages are unsupported on Kimi Web","Use a tool-capable provider for tool-calling conversations"],"exampleFix":null,"handlingStrategy":"validation","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"}