{"record":{"id":"8b993e5b5a4d42a8","repo":"jackwener/OpenCLI","slug":"minimax-music-returned-unknown-data-status-data","errorCode":null,"errorMessage":"MiniMax music returned unknown data.status ${data.status}","messagePattern":"MiniMax music returned unknown data\\.status (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/minimax/utils.js","lineNumber":113,"sourceCode":"            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(),\n        expectedBytes: payload.extra_info == null ? null : parseExpectedSize(payload.extra_info),\n    };\n}\n\nfunction parseExpectedSize(extraInfo) {\n    if (!extraInfo || typeof extraInfo !== 'object' || Array.isArray(extraInfo)) {\n        throw new CommandExecutionError('MiniMax music returned malformed extra_info');\n    }\n    if (extraInfo.music_size == null) return null;\n    if (!Number.isSafeInteger(extraInfo.music_size) || extraInfo.music_size <= 0) {\n        throw new CommandExecutionError('MiniMax music returned invalid extra_info.music_size');\n    }","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/minimax/utils.js#L95-L131","documentation":"MiniMax music responses are only expected to carry data.status of 1 (in progress), 2 (complete), or the failure statuses handled earlier. Any other integer (0, 3, 5, negative, etc.) is an unrecognized state, so the client throws rather than proceeding with possibly-partial output.","triggerScenarios":"MiniMax introduces a new status code (e.g. 3 = failed, 4 = expired) or returns 0 for queued/not-started, and the client version predates that value.","commonSituations":"MiniMax API update adding new lifecycle states; querying a job that failed with a code the old client does not know; sandbox vs production endpoints emitting different status enums.","solutions":["Print data.status and the full response to identify the new code","Check the current MiniMax music API docs for the meaning of the new status value","Update the client's status handling (and this error message) to map the new status explicitly","If the new status means failed, re-submit the generation request with the same parameters"],"exampleFix":"// before\nif (data.status !== 2) { throw ...; }\n// after\nif (data.status === 3) { throw new CommandExecutionError('MiniMax music generation failed'); }\nif (data.status !== 2) { throw new CommandExecutionError(`MiniMax music returned unknown data.status ${data.status}`); }","handlingStrategy":"validation","validationCode":"const KNOWN_STATUSES = new Set([1, 2]);\nif (hasIntegerStatus(payload) && !KNOWN_STATUSES.has(payload.data.status)) {\n  console.warn(`Unrecognized MiniMax music status: ${payload.data.status} — check API changelog`);\n}","typeGuard":"function isKnownMusicStatus(s) {\n  return s === 1 || s === 2;\n}","tryCatchPattern":"try {\n  const result = parseCompletedMusic(payload);\n} catch (e) {\n  const m = e.message.match(/unknown data\\.status (\\d+)/);\n  if (m) {\n    console.error(`New MiniMax status code ${m[1]} — consult current API docs`);\n  } else throw e;\n}","preventionTips":["Subscribe to MiniMax API changelog/release notes","Handle status codes exhaustively and log unknown values","Test against both sandbox and production endpoints","Version-pin the API surface your client targets"],"tags":["minimax","music","api-versioning","status-code"],"backgroundTag":"unexpected-api-status-code","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}