{"record":{"id":"0bff715111d10543","repo":"diegosouzapw/OmniRoute","slug":"hailuo-web-does-not-support-image-audio-file-or","errorCode":null,"errorMessage":"Hailuo Web does not support image, audio, file, or tool content","messagePattern":"Hailuo Web does not support image, audio, file, or tool content","errorType":"validation","errorClass":"Error","httpStatus":400,"severity":"error","filePath":"open-sse/executors/hailuo-web.ts","lineNumber":161,"sourceCode":"\nfunction textFromContent(content: unknown): string {\n  if (typeof content === \"string\") return content;\n  if (!Array.isArray(content)) {\n    throw new Error(\"Hailuo Web only supports text message content\");\n  }\n  return content\n    .map((part) => {\n      if (!part || typeof part !== \"object\" || Array.isArray(part)) {\n        throw new Error(\"Hailuo Web only supports text message content\");\n      }\n      const record = part as Record<string, unknown>;\n      if (\n        (record.type === \"text\" || record.type === \"input_text\") &&\n        typeof record.text === \"string\"\n      ) {\n        return record.text;\n      }\n      throw new Error(\"Hailuo Web does not support image, audio, file, or tool content\");\n    })\n    .join(\"\");\n}\n\n/** Fold text-only OpenAI history into the single msgContent field Hailuo accepts. */\nexport function foldHailuoMessages(messages: HailuoInputMessage[]): string {\n  const parts: string[] = [];\n  for (const message of messages) {\n    if (message.role === \"tool\" || message.role === \"function\") {\n      throw new Error(\"Hailuo Web does not support tool result messages\");\n    }\n    if (message.tool_calls !== undefined) {\n      throw new Error(\"Hailuo Web does not support assistant tool calls\");\n    }\n    const text = textFromContent(message.content);\n    if (!text) continue;\n    if (message.role === \"system\" || message.role === \"developer\") {\n      parts.push(`System: ${text}`);","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/open-sse/executors/hailuo-web.ts#L143-L179","documentation":"Capability validation in textFromContent: a content part is an object but its type is not text/input_text (e.g. image_url, input_audio, file, or tool output). The Hailuo web endpoint has no multimodal support, so any non-text part aborts message folding.","triggerScenarios":"Thrown at open-sse/executors/hailuo-web.ts:161 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reject the request with a 400 listing the unsupported content type","Route the request to a multimodal-capable provider via combo/fallback instead of Hailuo Web","Strip non-text parts pre-emptively if your integration never sends them"],"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"}