jackwener/OpenCLI · error · CommandExecutionError

MiniMax music response is missing integer data.status

Error message

MiniMax music response is missing integer data.status

What it means

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.

Source

Thrown at clis/minimax/utils.js:101

    if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
        throw new CommandExecutionError('MiniMax music returned a malformed response envelope');
    }
    const base = payload.base_resp;
    if (!base || typeof base !== 'object' || !Number.isInteger(base.status_code)) {
        throw new CommandExecutionError('MiniMax music response is missing integer base_resp.status_code');
    }
    if (base.status_code !== 0) {
        const message = typeof base.status_msg === 'string' && base.status_msg.trim()
            ? `: ${base.status_msg.trim()}`
            : '';
        if (AUTH_CODES.has(base.status_code)) {
            throw new AuthRequiredError(region.host, `MiniMax ${region.host} rejected ${MINIMAX_API_KEY_VAR} (service ${base.status_code}${message}).`);
        }
        throw new CommandExecutionError(`MiniMax music failed (service ${base.status_code}${message})`);
    }
    const data = payload.data;
    if (!data || typeof data !== 'object' || Array.isArray(data) || !Number.isInteger(data.status)) {
        throw new CommandExecutionError('MiniMax music response is missing integer data.status');
    }
    if (data.status === 1) {
        const traceId = typeof payload.trace_id === 'string' && /^[A-Za-z0-9_-]{1,128}$/.test(payload.trace_id.trim())
            ? payload.trace_id.trim()
            : '';
        throw new CommandExecutionError(
            `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(),

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Log the full raw response body (payload) to see what actually came back before parsing
  2. Verify the request hit the correct MiniMax music endpoint/region host with the right HTTP method and payload
  3. Check for a MiniMax API schema/changelog update and update this client to match the current response format
  4. Confirm no proxy or middleware is rewriting the response body (test from a clean network)

Example fix

// before: blindly passing API result
const parsed = parseCompletedMusic(res.body);
// after: sanity-check shape first
if (!res.body?.data || !Number.isInteger(res.body.data.status)) {
  console.error('unexpected body:', JSON.stringify(res.body).slice(0, 500));
}
const parsed = parseCompletedMusic(res.body);
Defensive patterns

Strategy: validation

Validate before calling

function looksLikeCompletedMusicResponse(body) {
  return body != null && typeof body === 'object' && !Array.isArray(body) &&
    body.data != null && typeof body.data === 'object' && !Array.isArray(body.data) &&
    Number.isInteger(body.data.status);
}
if (!looksLikeCompletedMusicResponse(payload)) {
  console.error('unexpected MiniMax body:', JSON.stringify(payload).slice(0, 500));
}

Type guard

function hasIntegerStatus(payload) {
  return Boolean(payload) && typeof payload === 'object' && !Array.isArray(payload) &&
    typeof payload.data === 'object' && payload.data !== null && !Array.isArray(payload.data) &&
    Number.isInteger(payload.data.status);
}

Try / catch

try {
  const result = parseCompletedMusic(payload);
} catch (e) {
  if (/missing integer data\.status/.test(e.message)) {
    console.error('Malformed MiniMax response:', JSON.stringify(payload).slice(0, 500));
    // fall back to raw inspection or retry
  } else throw e;
}

Prevention

When it happens

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

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

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