jackwener/OpenCLI · error · CommandExecutionError

MiniMax music response is missing integer base_resp.status_c

Error message

MiniMax music response is missing integer base_resp.status_code

What it means

A CommandExecutionError thrown by parseCompletedMusic() when payload.base_resp is missing, not an object, or lacks an integer status_code. base_resp.status_code is MiniMax's service-level result code; without it the library cannot distinguish success from failure, so it refuses to guess.

Source

Thrown at clis/minimax/utils.js:88

        throw new AuthRequiredError(region.host, `MiniMax ${region.host} rejected ${MINIMAX_API_KEY_VAR} (HTTP ${response.status}).`);
    }
    if (!response.ok) {
        throw new CommandExecutionError(`MiniMax music returned HTTP ${response.status} from ${region.host}`);
    }
    try {
        return await response.json();
    } catch (error) {
        throw new CommandExecutionError(`MiniMax music returned malformed JSON: ${error?.message ?? error}`);
    }
}

export function parseCompletedMusic(payload, region) {
    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()
            : '';

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Dump the full raw JSON and verify the expected {base_resp:{status_code,status_msg}, data:{...}} shape for the v1 music_generation endpoint.
  2. Confirm you are hitting /v1/music_generation, not another MiniMax product endpoint with a different envelope.
  3. Update the CLI/library if MiniMax changed the schema; check for a newer release.
  4. Fix test fixtures or scripts to include base_resp with an integer status_code.

Example fix

// before (fixture)
{data: {status: 2, audio: "..."}}

// after
{base_resp: {status_code: 0, status_msg: "success"}, data: {status: 2, audio: "..."}}
Defensive patterns

Strategy: type-guard

Type guard

function hasBaseResp(v) {
  return v != null && typeof v === 'object' && !Array.isArray(v)
    && v.base_resp != null && typeof v.base_resp === 'object'
    && Number.isInteger(v.base_resp.status_code);
}

Try / catch

try {
  const done = parseCompletedMusic(payload, region);
} catch (e) {
  if (e instanceof CommandExecutionError && /base_resp.status_code/.test(e.message)) {
    // dump raw JSON, confirm endpoint is /v1/music_generation, retry/update client
  } else throw e;
}

Prevention

When it happens

Trigger: The response object exists but base_resp is absent/null, a non-object, or its status_code is a string/float/undefined — e.g. {data: {...}} without base_resp, or {base_resp: {status_code: "0"}}.

Common situations: API version drift where MiniMax renames or nests the status field; intermediaries stripping fields; tests with hand-written fixtures omitting base_resp; non-music MiniMax endpoints' bodies accidentally routed into the music parser.

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