jackwener/OpenCLI · error · CommandExecutionError
MiniMax music returned HTTP ${response.status} from ${region
Error message
MiniMax music returned HTTP ${response.status} from ${region.host} What it means
A CommandExecutionError thrown by generateMusic() when MiniMax returns a non-2xx, non-401/403 HTTP status. It means the request was authenticated and delivered but rejected or failed at the server (rate limit, validation error, 5xx outage). The message includes the numeric status and region host for triage.
Source
Thrown at clis/minimax/utils.js:73
body: JSON.stringify(body),
signal: controller.signal,
});
} catch (error) {
if (controller.signal.aborted) {
throw new TimeoutError('MiniMax music generation', timeoutSeconds, 'The request may have been accepted; result and billing state are unknown. The API exposes no task id to resume, so check account history before submitting again.');
}
throw new CommandExecutionError(
`MiniMax music request failed: ${error?.message ?? error}`,
`Check that ${region.host} is reachable. The request may have reached MiniMax; check account history before retrying.`,
);
} finally {
clearTimeout(timer);
}
if (response.status === 401 || response.status === 403) {
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()View on GitHub (pinned to 49907e53dc)
Solutions
- Read the status code in the message: 4xx usually means fix the request payload; 5xx means retry later after an incident check.
- Validate request options (model, output_format, audio_setting values) against the current MiniMax music_generation API docs.
- For 429, add backoff and reduce submission rate before retrying.
- For 5xx, check the MiniMax status/announcements and retry with backoff; verify account history in case a partial job was recorded.
Example fix
// before (invalid model name)
buildRequest({model: "music-v1"})
// MiniMax music returned HTTP 400 from api.minimax.io
// after
buildRequest({model: "music-01", audioFormat: "mp3", outputFormat: "url"}) Defensive patterns
Strategy: try-catch
Validate before calling
// validate request options against allowed values before sending
const allowed = new Set(['music-01']);
if (!allowed.has(options.model)) throw new Error(`Unsupported model: ${options.model}`);
if (![8000, 16000, 32000, 44100].includes(options.sampleRate)) throw new Error('Invalid sample_rate'); Try / catch
try {
const res = await generateMusic(region, apiKey, body, 60);
} catch (e) {
const m = /HTTP (\d{3})/.exec(e.message ?? '');
if (m) {
const status = Number(m[1]);
if (status === 429) { /* back off and retry */ }
else if (status >= 500) { /* retry later; check MiniMax status */ }
else { /* fix payload */ }
} else throw e;
} Prevention
- Keep request payloads aligned with the current MiniMax API spec.
- Throttle submissions to stay under rate limits.
- Log full options with each call so 4xx causes are reproducible.
- Subscribe to MiniMax status updates for 5xx incidents.
When it happens
Trigger: response.ok is false and status is not 401/403 — e.g. HTTP 400 for invalid request body (bad model name, malformed lyrics), HTTP 429 rate limiting after rapid submissions, or HTTP 5xx when the MiniMax music service is degraded.
Common situations: Sending unsupported model or output_format values; hammering the endpoint and hitting 429; MiniMax incidents producing 502/503; oversized lyrics payloads triggering 413; passing invalid sample_rate/bitrate combinations.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- Ctrip flight API returned HTTP ${status || 'unknown'}
- HTTP ${result.httpStatus} from /api/auth/session
- OpenReview API HTTP ${resp.status} for ${label}${body ? ` ($
- Detached HEAD — checkout a branch first
- autohome ${contextHint} HTTP ${resp.status}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/94e0ca37e95605b4.
Report an issue: GitHub.