{"record":{"id":"030dda5fccd2c601","repo":"jackwener/OpenCLI","slug":"minimax-music-returned-invalid-extra-info-music-si","errorCode":null,"errorMessage":"MiniMax music returned invalid extra_info.music_size","messagePattern":"MiniMax music returned invalid extra_info\\.music_size","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/minimax/utils.js","lineNumber":130,"sourceCode":"    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    }\n    return extraInfo.music_size;\n}\n\nexport function requireAudioUrl(value) {\n    let url;\n    try {\n        url = new URL(value);\n    } catch {\n        throw new CommandExecutionError('MiniMax music returned data.audio that is not a URL');\n    }\n    if (url.protocol !== 'https:') {\n        throw new CommandExecutionError(`MiniMax music returned a non-HTTPS audio URL (${url.protocol})`);\n    }\n    return url.toString();\n}\n\nexport function decodeAudioHex(value, expectedBytes, format) {","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/minimax/utils.js#L112-L148","documentation":"When extra_info.music_size is present it must be a positive safe integer (Number.isSafeInteger and > 0) representing the exact byte length of the decoded audio. Anything else — float, string, zero, negative, or an impossibly large number — throws, because the later size-mismatch check relies on a trustworthy value.","triggerScenarios":"MiniMax reports music_size as 0 or negative for a corrupted job; the value arrives as a string (\"48304\") or float; the value exceeds Number.MAX_SAFE_INTEGER due to a server bug or unit change (e.g. bits vs bytes).","commonSituations":"MiniMax-side bug emitting music_size: 0 on failed-but-completed jobs; a schema change changing units or type; hand-written mocks with placeholder values like \"12345\".","solutions":["Print extra_info.music_size and typeof it to see the actual value/type","If it arrives as a numeric string, coerce with Number() before the parse path","Retry the generation — a size of 0 usually indicates a bad server-side job","Compare against the actually downloaded byte length; if the audio itself is fine, report the wrong music_size to MiniMax and consider relaxing the strict check in a local fork"],"exampleFix":"// before: raw value\nconst size = body.extra_info.music_size; // \"48304\"\n// after\nconst size = typeof body.extra_info.music_size === 'string'\n  ? Number(body.extra_info.music_size)\n  : body.extra_info.music_size;","handlingStrategy":"validation","validationCode":"const ms = payload?.extra_info?.music_size;\nif (ms != null && !(Number.isSafeInteger(Number(ms)) && Number(ms) > 0)) {\n  console.warn(`Suspicious music_size: ${JSON.stringify(ms)} — will likely be rejected`);\n}","typeGuard":"function isValidMusicSize(v) {\n  return Number.isSafeInteger(v) && v > 0;\n}","tryCatchPattern":"try {\n  const result = parseCompletedMusic(payload);\n} catch (e) {\n  if (/invalid extra_info\\.music_size/.test(e.message)) {\n    console.warn('Bad music_size from MiniMax; proceeding without size verification');\n    // re-parse treating extra_info.music_size as absent\n  } else throw e;\n}","preventionTips":["Coerce numeric strings to numbers before parsing","Treat music_size 0 as a failed job and retry","Log music_size alongside the downloaded byte length for auditing","Report consistent metadata bugs to MiniMax"],"tags":["minimax","music","validation","byte-size"],"backgroundTag":"schema-validation-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}