{"record":{"id":"94e0ca37e95605b4","repo":"jackwener/OpenCLI","slug":"minimax-music-returned-http-response-status-fro","errorCode":null,"errorMessage":"MiniMax music returned HTTP ${response.status} from ${region.host}","messagePattern":"MiniMax music returned HTTP (.+?) from (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/minimax/utils.js","lineNumber":73,"sourceCode":"            body: JSON.stringify(body),\n            signal: controller.signal,\n        });\n    } catch (error) {\n        if (controller.signal.aborted) {\n            throw new TimeoutError('MiniMax music generation', timeoutSeconds, 'The request may have been accepted; result and billing state are unknown. The API exposes no task id to resume, so check account history before submitting again.');\n        }\n        throw new CommandExecutionError(\n            `MiniMax music request failed: ${error?.message ?? error}`,\n            `Check that ${region.host} is reachable. The request may have reached MiniMax; check account history before retrying.`,\n        );\n    } finally {\n        clearTimeout(timer);\n    }\n    if (response.status === 401 || response.status === 403) {\n        throw new AuthRequiredError(region.host, `MiniMax ${region.host} rejected ${MINIMAX_API_KEY_VAR} (HTTP ${response.status}).`);\n    }\n    if (!response.ok) {\n        throw new CommandExecutionError(`MiniMax music returned HTTP ${response.status} from ${region.host}`);\n    }\n    try {\n        return await response.json();\n    } catch (error) {\n        throw new CommandExecutionError(`MiniMax music returned malformed JSON: ${error?.message ?? error}`);\n    }\n}\n\nexport function parseCompletedMusic(payload, region) {\n    if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {\n        throw new CommandExecutionError('MiniMax music returned a malformed response envelope');\n    }\n    const base = payload.base_resp;\n    if (!base || typeof base !== 'object' || !Number.isInteger(base.status_code)) {\n        throw new CommandExecutionError('MiniMax music response is missing integer base_resp.status_code');\n    }\n    if (base.status_code !== 0) {\n        const message = typeof base.status_msg === 'string' && base.status_msg.trim()","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/minimax/utils.js#L55-L91","documentation":"A CommandExecutionError thrown by generateMusic() when MiniMax returns a non-2xx, non-401/403 HTTP status. It means the request was authenticated and delivered but rejected or failed at the server (rate limit, validation error, 5xx outage). The message includes the numeric status and region host for triage.","triggerScenarios":"response.ok is false and status is not 401/403 — e.g. HTTP 400 for invalid request body (bad model name, malformed lyrics), HTTP 429 rate limiting after rapid submissions, or HTTP 5xx when the MiniMax music service is degraded.","commonSituations":"Sending unsupported model or output_format values; hammering the endpoint and hitting 429; MiniMax incidents producing 502/503; oversized lyrics payloads triggering 413; passing invalid sample_rate/bitrate combinations.","solutions":["Read the status code in the message: 4xx usually means fix the request payload; 5xx means retry later after an incident check.","Validate request options (model, output_format, audio_setting values) against the current MiniMax music_generation API docs.","For 429, add backoff and reduce submission rate before retrying.","For 5xx, check the MiniMax status/announcements and retry with backoff; verify account history in case a partial job was recorded."],"exampleFix":"// before (invalid model name)\nbuildRequest({model: \"music-v1\"})\n// MiniMax music returned HTTP 400 from api.minimax.io\n\n// after\nbuildRequest({model: \"music-01\", audioFormat: \"mp3\", outputFormat: \"url\"})","handlingStrategy":"try-catch","validationCode":"// validate request options against allowed values before sending\nconst allowed = new Set(['music-01']);\nif (!allowed.has(options.model)) throw new Error(`Unsupported model: ${options.model}`);\nif (![8000, 16000, 32000, 44100].includes(options.sampleRate)) throw new Error('Invalid sample_rate');","typeGuard":null,"tryCatchPattern":"try {\n  const res = await generateMusic(region, apiKey, body, 60);\n} catch (e) {\n  const m = /HTTP (\\d{3})/.exec(e.message ?? '');\n  if (m) {\n    const status = Number(m[1]);\n    if (status === 429) { /* back off and retry */ }\n    else if (status >= 500) { /* retry later; check MiniMax status */ }\n    else { /* fix payload */ }\n  } else throw e;\n}","preventionTips":["Keep request payloads aligned with the current MiniMax API spec.","Throttle submissions to stay under rate limits.","Log full options with each call so 4xx causes are reproducible.","Subscribe to MiniMax status updates for 5xx incidents."],"tags":["http","api-error","rate-limit","server-error"],"backgroundTag":"http-error-response","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}