{"record":{"id":"6340e5da700e1bf6","repo":"diegosouzapw/OmniRoute","slug":"hailuo-web-requires-a-non-empty-user-message","errorCode":null,"errorMessage":"Hailuo Web requires a non-empty user message","messagePattern":"Hailuo Web requires a non-empty user message","errorType":"validation","errorClass":"Error","httpStatus":400,"severity":"error","filePath":"open-sse/executors/hailuo-web.ts","lineNumber":333,"sourceCode":"    }\n  }\n\n  /** Validate tool/function-call fields and fold messages into a single msgContent string. */\n  private prepareMsgContent(bodyObj: JsonRecord): { msgContent: string } | { error: string } {\n    const tools = bodyObj.tools;\n    const functions = bodyObj.functions;\n    if (tools != null && (!Array.isArray(tools) || tools.length > 0)) {\n      return { error: \"Hailuo Web does not support OpenAI function tools\" };\n    }\n    if (functions != null && (!Array.isArray(functions) || functions.length > 0)) {\n      return { error: \"Hailuo Web does not support legacy function tools\" };\n    }\n    try {\n      const messages = Array.isArray(bodyObj.messages)\n        ? (bodyObj.messages as HailuoInputMessage[])\n        : [];\n      const msgContent = foldHailuoMessages(messages);\n      if (!msgContent) throw new Error(\"Hailuo Web requires a non-empty user message\");\n      return { msgContent };\n    } catch (error) {\n      return { error: error instanceof Error ? error.message : \"Invalid Hailuo Web request\" };\n    }\n  }\n\n  /** Build the signed request: URL, headers, and the multipart form body. */\n  private buildSignedRequest(\n    token: string,\n    providerSpecificData: unknown,\n    msgContent: string\n  ): { url: string; headers: Record<string, string>; form: FormData } {\n    const now = Date.now();\n    const pathAndQuery = buildHailuoPathAndQuery(token, providerSpecificData, now);\n    const psd = asRecord(providerSpecificData);\n    const characterID = toStringOrEmpty(psd.characterID) || DEFAULT_CHARACTER_ID;\n    const chatID = toStringOrEmpty(psd.chatID) || DEFAULT_CHAT_ID;\n    const bodyToYy = getBodyToYy(characterID, msgContent, chatID);","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/open-sse/executors/hailuo-web.ts#L315-L351","documentation":"Validation in prepareMsgContent (returned as an error result, not a throw): after folding messages, the resulting msgContent/user prompt is empty. Hailuo's web chat requires a non-empty user message; the request had no user text after filtering empty/system-only content.","triggerScenarios":"Thrown at open-sse/executors/hailuo-web.ts:333 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Surface the error result to the client as a 400 asking for a non-empty user message","Pre-validate that at least one user message with non-empty text exists before dispatching to the Hailuo executor"],"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"}