{"record":{"id":"589cc7edd96057ed","repo":"jackwener/OpenCLI","slug":"minimax-music-request-failed-error-message","errorCode":null,"errorMessage":"MiniMax music request failed: ${error?.message ?? error}","messagePattern":"MiniMax music request failed: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/minimax/utils.js","lineNumber":62,"sourceCode":"    const timer = setTimeout(() => controller.abort(), timeoutSeconds * 1000);\n    timer.unref?.();\n    let response;\n    try {\n        response = await fetch(region.endpoint, {\n            method: 'POST',\n            headers: {\n                authorization: `Bearer ${apiKey}`,\n                'content-type': 'application/json',\n                accept: 'application/json',\n            },\n            body: JSON.stringify(body),\n            signal: controller.signal,\n        });\n    } catch (error) {\n        if (controller.signal.aborted) {\n            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.');\n        }\n        throw new CommandExecutionError(\n            `MiniMax music request failed: ${error?.message ?? error}`,\n            `Check that ${region.host} is reachable. The request may have reached MiniMax; check account history before retrying.`,\n        );\n    } finally {\n        clearTimeout(timer);\n    }\n    if (response.status === 401 || response.status === 403) {\n        throw new AuthRequiredError(region.host, `MiniMax ${region.host} rejected ${MINIMAX_API_KEY_VAR} (HTTP ${response.status}).`);\n    }\n    if (!response.ok) {\n        throw new CommandExecutionError(`MiniMax music returned HTTP ${response.status} from ${region.host}`);\n    }\n    try {\n        return await response.json();\n    } catch (error) {\n        throw new CommandExecutionError(`MiniMax music returned malformed JSON: ${error?.message ?? error}`);\n    }\n}","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/minimax/utils.js#L44-L80","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm basic reachability: curl -v https://api.minimax.io/v1/music_generation (or api.minimaxi.com for cn region).","Check DNS/proxy settings (HTTPS_PROXY/HTTP_PROXY env vars) and corporate firewall rules for the MiniMax hosts.","Retry after verifying the network is stable; if a request may have reached MiniMax, check account history before resubmitting.","Switch region (global vs cn) if one host is unreachable from your network."],"exampleFix":"// before\nminimax music --region cn --prompt \"jazz\"\n// MiniMax music request failed: getaddrinfo api.minimaxi.com ENOTFOUND\n\n// after (verify network/proxy first, or use reachable region)\nexport HTTPS_PROXY=http://proxy.corp:8080\nminimax music --region global --prompt \"jazz\"","handlingStrategy":"retry","validationCode":"// preflight reachability check\nawait fetch('https://api.minimax.io', {method: 'HEAD'})\n  .catch(() => { throw new Error('api.minimax.io unreachable — check network/proxy/DNS'); });","typeGuard":null,"tryCatchPattern":"try {\n  const res = await generateMusic(region, apiKey, body, 60);\n} catch (e) {\n  if (e instanceof CommandExecutionError && /request failed/.test(e.message)) {\n    // network-level failure: retry with backoff after checking connectivity\n  } else throw e;\n}","preventionTips":["Preflight the region host with a HEAD/GET request in scripts.","Configure HTTPS_PROXY correctly in corporate environments.","Pin region selection to the host your network can reach.","Add exponential backoff instead of immediate resubmission."],"tags":["network","fetch","connection","dns"],"backgroundTag":"network-request-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}