diegosouzapw/OmniRoute · error · Error

Hailuo Web does not support image, audio, file, or tool…

Error message

Hailuo Web does not support image, audio, file, or tool content

What it means

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.

Solutions

  1. Reject the request with a 400 listing the unsupported content type
  2. Route the request to a multimodal-capable provider via combo/fallback instead of Hailuo Web
  3. Strip non-text parts pre-emptively if your integration never sends them
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at open-sse/executors/hailuo-web.ts:161 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/0bff715111d10543. Report an issue: GitHub.

Appendix: source

Thrown at open-sse/executors/hailuo-web.ts:161

function textFromContent(content: unknown): string {
  if (typeof content === "string") return content;
  if (!Array.isArray(content)) {
    throw new Error("Hailuo Web only supports text message content");
  }
  return content
    .map((part) => {
      if (!part || typeof part !== "object" || Array.isArray(part)) {
        throw new Error("Hailuo Web only supports text message content");
      }
      const record = part as Record<string, unknown>;
      if (
        (record.type === "text" || record.type === "input_text") &&
        typeof record.text === "string"
      ) {
        return record.text;
      }
      throw new Error("Hailuo Web does not support image, audio, file, or tool content");
    })
    .join("");
}

/** Fold text-only OpenAI history into the single msgContent field Hailuo accepts. */
export function foldHailuoMessages(messages: HailuoInputMessage[]): string {
  const parts: string[] = [];
  for (const message of messages) {
    if (message.role === "tool" || message.role === "function") {
      throw new Error("Hailuo Web does not support tool result messages");
    }
    if (message.tool_calls !== undefined) {
      throw new Error("Hailuo Web does not support assistant tool calls");
    }
    const text = textFromContent(message.content);
    if (!text) continue;
    if (message.role === "system" || message.role === "developer") {
      parts.push(`System: ${text}`);

View on GitHub (pinned to a179ffed5b)