{"record":{"id":"7260680172b923da","repo":"jackwener/OpenCLI","slug":"minimax-music-response-is-missing-integer-data-sta","errorCode":null,"errorMessage":"MiniMax music response is missing integer data.status","messagePattern":"MiniMax music response is missing integer data\\.status","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/minimax/utils.js","lineNumber":101,"sourceCode":"    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()) {\n        throw new CommandExecutionError('MiniMax music reported completion without data.audio');\n    }\n    return {\n        audio: data.audio.trim(),","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/minimax/utils.js#L83-L119","documentation":"Thrown by parseCompletedMusic when the MiniMax music API response body lacks a data object or its data.status field is not an integer. The library uses data.status to decide whether generation completed (2), is in progress (1), or failed, so a missing/non-integer status makes the response uninterpretable and it refuses to guess.","triggerScenarios":"MiniMax returns 200 but the JSON body has no data field, data is null/an array/string, or data.status is absent, a string (e.g. \"2\"), null, or a float. Typically happens when the API response schema changes, a proxy/gateway returns an HTML or wrapped error body with HTTP 200, or the wrong endpoint base status shape is parsed.","commonSituations":"MiniMax API version change altering the response envelope; misconfigured region.host pointing to an endpoint returning a different shape; corporate proxy injecting an error page; copying a response-shape from an older MiniMax SDK version.","solutions":["Log the full raw response body (payload) to see what actually came back before parsing","Verify the request hit the correct MiniMax music endpoint/region host with the right HTTP method and payload","Check for a MiniMax API schema/changelog update and update this client to match the current response format","Confirm no proxy or middleware is rewriting the response body (test from a clean network)"],"exampleFix":"// before: blindly passing API result\nconst parsed = parseCompletedMusic(res.body);\n// after: sanity-check shape first\nif (!res.body?.data || !Number.isInteger(res.body.data.status)) {\n  console.error('unexpected body:', JSON.stringify(res.body).slice(0, 500));\n}\nconst parsed = parseCompletedMusic(res.body);","handlingStrategy":"validation","validationCode":"function looksLikeCompletedMusicResponse(body) {\n  return body != null && typeof body === 'object' && !Array.isArray(body) &&\n    body.data != null && typeof body.data === 'object' && !Array.isArray(body.data) &&\n    Number.isInteger(body.data.status);\n}\nif (!looksLikeCompletedMusicResponse(payload)) {\n  console.error('unexpected MiniMax body:', JSON.stringify(payload).slice(0, 500));\n}","typeGuard":"function hasIntegerStatus(payload) {\n  return Boolean(payload) && typeof payload === 'object' && !Array.isArray(payload) &&\n    typeof payload.data === 'object' && payload.data !== null && !Array.isArray(payload.data) &&\n    Number.isInteger(payload.data.status);\n}","tryCatchPattern":"try {\n  const result = parseCompletedMusic(payload);\n} catch (e) {\n  if (/missing integer data\\.status/.test(e.message)) {\n    console.error('Malformed MiniMax response:', JSON.stringify(payload).slice(0, 500));\n    // fall back to raw inspection or retry\n  } else throw e;\n}","preventionTips":["Log the raw response body on every parse failure","Pin and monitor the MiniMax API version you integrate against","Test the parser against recorded real responses, not hand-made fixtures","Check for proxies/gateways that rewrite 200 responses"],"tags":["minimax","schema-validation","api-response","music"],"backgroundTag":"schema-validation-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}