jackwener/OpenCLI · error · CommandExecutionError

MiniMax music returned invalid extra_info.music_size

Error message

MiniMax music returned invalid extra_info.music_size

What it means

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.

Source

Thrown at clis/minimax/utils.js:130

    if (data.status !== 2) {
        throw new CommandExecutionError(`MiniMax music returned unknown data.status ${data.status}`);
    }
    if (typeof data.audio !== 'string' || !data.audio.trim()) {
        throw new CommandExecutionError('MiniMax music reported completion without data.audio');
    }
    return {
        audio: data.audio.trim(),
        expectedBytes: payload.extra_info == null ? null : parseExpectedSize(payload.extra_info),
    };
}

function parseExpectedSize(extraInfo) {
    if (!extraInfo || typeof extraInfo !== 'object' || Array.isArray(extraInfo)) {
        throw new CommandExecutionError('MiniMax music returned malformed extra_info');
    }
    if (extraInfo.music_size == null) return null;
    if (!Number.isSafeInteger(extraInfo.music_size) || extraInfo.music_size <= 0) {
        throw new CommandExecutionError('MiniMax music returned invalid extra_info.music_size');
    }
    return extraInfo.music_size;
}

export function requireAudioUrl(value) {
    let url;
    try {
        url = new URL(value);
    } catch {
        throw new CommandExecutionError('MiniMax music returned data.audio that is not a URL');
    }
    if (url.protocol !== 'https:') {
        throw new CommandExecutionError(`MiniMax music returned a non-HTTPS audio URL (${url.protocol})`);
    }
    return url.toString();
}

export function decodeAudioHex(value, expectedBytes, format) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Print extra_info.music_size and typeof it to see the actual value/type
  2. If it arrives as a numeric string, coerce with Number() before the parse path
  3. Retry the generation — a size of 0 usually indicates a bad server-side job
  4. 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

Example fix

// before: raw value
const size = body.extra_info.music_size; // "48304"
// after
const size = typeof body.extra_info.music_size === 'string'
  ? Number(body.extra_info.music_size)
  : body.extra_info.music_size;
Defensive patterns

Strategy: validation

Validate before calling

const ms = payload?.extra_info?.music_size;
if (ms != null && !(Number.isSafeInteger(Number(ms)) && Number(ms) > 0)) {
  console.warn(`Suspicious music_size: ${JSON.stringify(ms)} — will likely be rejected`);
}

Type guard

function isValidMusicSize(v) {
  return Number.isSafeInteger(v) && v > 0;
}

Try / catch

try {
  const result = parseCompletedMusic(payload);
} catch (e) {
  if (/invalid extra_info\.music_size/.test(e.message)) {
    console.warn('Bad music_size from MiniMax; proceeding without size verification');
    // re-parse treating extra_info.music_size as absent
  } else throw e;
}

Prevention

When it happens

Trigger: 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).

Common situations: 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".

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/030dda5fccd2c601. Report an issue: GitHub.