jackwener/OpenCLI · error · CommandExecutionError

MiniMax music returned malformed extra_info

Error message

MiniMax music returned malformed extra_info

What it means

parseExpectedSize validates payload.extra_info, which should carry the expected decoded audio byte count. If extra_info is present (non-null) but is not a plain object (null handled earlier, or a string/number/array), the client treats the response as malformed and throws, since it cannot trust the size metadata.

Source

Thrown at clis/minimax/utils.js:126

            `MiniMax music returned status 1 (in progress) without a resumable task id${traceId ? ` (trace_id: ${traceId})` : ''}`,
            'Do not resubmit blindly: this endpoint exposes no query command, so check MiniMax account history first.',
        );
    }
    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})`);
    }

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Log payload.extra_info and its typeof to see what was actually returned
  2. If extra_info arrives as a JSON string, JSON.parse it before calling the parse path
  3. Pin/verify the MiniMax API version you are calling matches the client's expected schema
  4. If you do not need byte verification, check whether the client supports omitting/ignoring extra_info (it returns null only when the field is absent)

Example fix

// before: passing raw body
parseCompletedMusic(body);
// after: normalize stringified extra_info
if (typeof body.extra_info === 'string') {
  try { body.extra_info = JSON.parse(body.extra_info); } catch { body.extra_info = null; }
}
parseCompletedMusic(body);
Defensive patterns

Strategy: type-guard

Validate before calling

if (payload.extra_info != null &&
    (typeof payload.extra_info !== 'object' || Array.isArray(payload.extra_info))) {
  if (typeof payload.extra_info === 'string') {
    payload.extra_info = JSON.parse(payload.extra_info);
  }
}

Type guard

function isPlainObject(v) {
  return v != null && typeof v === 'object' && !Array.isArray(v);
}

Try / catch

try {
  const result = parseCompletedMusic(payload);
} catch (e) {
  if (/malformed extra_info/.test(e.message)) {
    console.error('extra_info shape:', typeof payload.extra_info, JSON.stringify(payload.extra_info));
  } else throw e;
}

Prevention

When it happens

Trigger: MiniMax returns extra_info as a JSON string instead of an object, as an array, or the client wraps it differently; API schema change altering extra_info's type.

Common situations: Proxy or middleware re-serializing the response body; older/newer MiniMax API versions with different extra_info encoding; hand-rolled test fixtures passing the wrong shape.

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/e18b3d3f15df3170. Report an issue: GitHub.