jackwener/OpenCLI · error · CommandExecutionError

MiniMax music request failed: ${error?.message ?? error}

Error message

MiniMax music request failed: ${error?.message ?? error}

What it means

A CommandExecutionError thrown by generateMusic() when the fetch itself rejects for any reason other than the client-side timeout abort (e.g. DNS failure, TLS error, connection refused/reset). The library wraps the underlying Node error message into a command-level error and suggests checking host reachability, warning that the request may still have reached MiniMax.

Source

Thrown at clis/minimax/utils.js:62

    const timer = setTimeout(() => controller.abort(), timeoutSeconds * 1000);
    timer.unref?.();
    let response;
    try {
        response = await fetch(region.endpoint, {
            method: 'POST',
            headers: {
                authorization: `Bearer ${apiKey}`,
                'content-type': 'application/json',
                accept: 'application/json',
            },
            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}`);
    }
}

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Confirm basic reachability: curl -v https://api.minimax.io/v1/music_generation (or api.minimaxi.com for cn region).
  2. Check DNS/proxy settings (HTTPS_PROXY/HTTP_PROXY env vars) and corporate firewall rules for the MiniMax hosts.
  3. Retry after verifying the network is stable; if a request may have reached MiniMax, check account history before resubmitting.
  4. Switch region (global vs cn) if one host is unreachable from your network.

Example fix

// before
minimax music --region cn --prompt "jazz"
// MiniMax music request failed: getaddrinfo api.minimaxi.com ENOTFOUND

// after (verify network/proxy first, or use reachable region)
export HTTPS_PROXY=http://proxy.corp:8080
minimax music --region global --prompt "jazz"
Defensive patterns

Strategy: retry

Validate before calling

// preflight reachability check
await fetch('https://api.minimax.io', {method: 'HEAD'})
  .catch(() => { throw new Error('api.minimax.io unreachable — check network/proxy/DNS'); });

Try / catch

try {
  const res = await generateMusic(region, apiKey, body, 60);
} catch (e) {
  if (e instanceof CommandExecutionError && /request failed/.test(e.message)) {
    // network-level failure: retry with backoff after checking connectivity
  } else throw e;
}

Prevention

When it happens

Trigger: The fetch POST to region.endpoint throws before an HTTP response exists and controller.signal.aborted is false — DNS resolution failure, TCP connection refused, TLS handshake failure, socket reset, or a proxy/agent error.

Common situations: No internet or captive-portal networks; corporate proxies blocking api.minimax.io/api.minimaxi.com; firewall rules in containers/CI; intermittent DNS failures; VPN required for the selected region.

Related errors


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