{"record":{"id":"244dfaa921662415","repo":"jackwener/OpenCLI","slug":"minimax-music-failed-service-base-status-code","errorCode":null,"errorMessage":"MiniMax music failed (service ${base.status_code}${message})","messagePattern":"MiniMax music failed \\(service (.+?)(.+?)\\)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/minimax/utils.js","lineNumber":97,"sourceCode":"    }\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()\n            ? `: ${base.status_msg.trim()}`\n            : '';\n        if (AUTH_CODES.has(base.status_code)) {\n            throw new AuthRequiredError(region.host, `MiniMax ${region.host} rejected ${MINIMAX_API_KEY_VAR} (service ${base.status_code}${message}).`);\n        }\n        throw new CommandExecutionError(`MiniMax music failed (service ${base.status_code}${message})`);\n    }\n    const data = payload.data;\n    if (!data || typeof data !== 'object' || Array.isArray(data) || !Number.isInteger(data.status)) {\n        throw new CommandExecutionError('MiniMax music response is missing integer data.status');\n    }\n    if (data.status === 1) {\n        const traceId = typeof payload.trace_id === 'string' && /^[A-Za-z0-9_-]{1,128}$/.test(payload.trace_id.trim())\n            ? payload.trace_id.trim()\n            : '';\n        throw new CommandExecutionError(\n            `MiniMax music returned status 1 (in progress) without a resumable task id${traceId ? ` (trace_id: ${traceId})` : ''}`,\n            'Do not resubmit blindly: this endpoint exposes no query command, so check MiniMax account history first.',\n        );\n    }\n    if (data.status !== 2) {\n        throw new CommandExecutionError(`MiniMax music returned unknown data.status ${data.status}`);\n    }\n    if (typeof data.audio !== 'string' || !data.audio.trim()) {","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/minimax/utils.js#L79-L115","documentation":"A CommandExecutionError thrown by parseCompletedMusic() when base_resp.status_code is a non-zero, non-auth code — i.e. MiniMax's service rejected the generation request for a domain reason (invalid parameters, content policy, model unavailable). The optional status_msg from MiniMax is appended after the code.","triggerScenarios":"HTTP 200 with base_resp.status_code not in {0, 1004, 2049} — e.g. invalid prompt/lyrics parameters, content moderation refusal, model capacity errors, or any other service-side failure code returned in the envelope.","commonSituations":"Prompts or lyrics violating MiniMax content policy; unsupported model/output_format values for the account tier; transient capacity errors on the music model; malformed audio_setting (bad sample_rate/bitrate) rejected server-side.","solutions":["Read the appended status_msg (after the code) and look it up in MiniMax's base_resp status code documentation.","Simplify or reword the prompt/lyrics to rule out content-moderation rejections.","Validate model and audio_setting parameters against current MiniMax music_generation docs.","If the code indicates a transient/capacity issue, wait and retry; check account history first to avoid duplicate billing."],"exampleFix":"// before (moderation refusal on service 2013)\nminimax music --lyrics \"<policy-violating text>\"\n\n// after\nminimax music --lyrics \"clean, original lyrics\" --model music-01","handlingStrategy":"try-catch","validationCode":"// validate inputs likely to trigger service rejections before submitting\nif (!options.prompt && !options.lyrics) throw new Error('Provide a prompt or lyrics');\nif (options.lyrics && options.lyrics.length > 3000) throw new Error('Lyrics too long for music_generation');","typeGuard":null,"tryCatchPattern":"try {\n  const done = parseCompletedMusic(payload, region);\n} catch (e) {\n  const m = /service (\\d+)(.*)/.exec(e.message ?? '');\n  if (e instanceof CommandExecutionError && m) {\n    console.error(`MiniMax rejected generation (code ${m[1]}${m[2]}): check docs, adjust prompt/params, then retry.`);\n  } else throw e;\n}","preventionTips":["Screen prompts/lyrics for content-policy risk before submission.","Use documented model names and audio_setting values only.","Record status_code/status_msg pairs you encounter to build an internal runbook.","Retry only codes known to be transient; check account history first."],"tags":["service-error","api-error","content-policy","response-parsing"],"backgroundTag":"service-status-code-error","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}