diegosouzapw/OmniRoute · error · Error
Hailuo Web does not support assistant tool calls
Error message
Hailuo Web does not support assistant tool calls
What it means
Capability validation in foldHailuoMessages: an assistant message carries a tool_calls field. Hailuo Web cannot replay assistant tool calls in its folded single prompt, so their presence aborts the fold.
Solutions
- Return a 400: assistant tool_calls are not supported by Hailuo Web
- Route tool-calling conversations to a provider with tool support
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at open-sse/executors/hailuo-web.ts:174 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/aec6e05d403889e1.
Report an issue: GitHub.
Appendix: source
Thrown at open-sse/executors/hailuo-web.ts:174
(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}`);
} else if (message.role === "user") {
parts.push(parts.length > 0 ? `User: ${text}` : text);
} else if (message.role === "assistant") {
parts.push(`Assistant: ${text}`);
} else {
throw new Error(`Hailuo Web does not support message role ${message.role}`);
}
}
return parts.join("\n\n").trim();
}
export interface HailuoStreamState {
emittedLen: number;View on GitHub (pinned to a179ffed5b)