diegosouzapw/OmniRoute · error · Error
Hailuo Web only supports text message content
Error message
Hailuo Web only supports text message content
What it means
Capability validation in textFromContent (Hailuo Web): the message content is not a string and not an array — or an array element is not an object. Hailuo's web API accepts only a single text prompt, so any other content shape (numbers, null, nested arrays) is rejected before the request is sent.
Solutions
- Return a 400 to the client: Hailuo Web supports only text message content
- Normalize non-array/string content to a string (e.g. String(content)) if lenient folding is desired
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at open-sse/executors/hailuo-web.ts:152 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/5413e0d6c94419da.
Report an issue: GitHub.
Appendix: source
Thrown at open-sse/executors/hailuo-web.ts:152
});
return `${API_PATH}?${params.toString()}`;
}
type HailuoInputMessage = {
role: string;
content: unknown;
tool_calls?: unknown;
};
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") {View on GitHub (pinned to a179ffed5b)