{"record":{"id":"a96bbfff8bdcd5b4","repo":"jackwener/OpenCLI","slug":"minimax-music-returned-a-non-https-audio-url-ur","errorCode":null,"errorMessage":"MiniMax music returned a non-HTTPS audio URL (${url.protocol})","messagePattern":"MiniMax music returned a non-HTTPS audio URL \\((.+?)\\)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/minimax/utils.js","lineNumber":143,"sourceCode":"    if (!extraInfo || typeof extraInfo !== 'object' || Array.isArray(extraInfo)) {\n        throw new CommandExecutionError('MiniMax music returned malformed extra_info');\n    }\n    if (extraInfo.music_size == null) return null;\n    if (!Number.isSafeInteger(extraInfo.music_size) || extraInfo.music_size <= 0) {\n        throw new CommandExecutionError('MiniMax music returned invalid extra_info.music_size');\n    }\n    return extraInfo.music_size;\n}\n\nexport function requireAudioUrl(value) {\n    let url;\n    try {\n        url = new URL(value);\n    } catch {\n        throw new CommandExecutionError('MiniMax music returned data.audio that is not a URL');\n    }\n    if (url.protocol !== 'https:') {\n        throw new CommandExecutionError(`MiniMax music returned a non-HTTPS audio URL (${url.protocol})`);\n    }\n    return url.toString();\n}\n\nexport function decodeAudioHex(value, expectedBytes, format) {\n    if (value.length === 0 || value.length % 2 !== 0 || !/^[0-9a-f]+$/i.test(value)) {\n        throw new CommandExecutionError('MiniMax music returned invalid hexadecimal audio');\n    }\n    const bytes = Buffer.from(value, 'hex');\n    if (expectedBytes != null && bytes.length !== expectedBytes) {\n        throw new CommandExecutionError(`MiniMax music audio size mismatch (expected ${expectedBytes} bytes, got ${bytes.length})`);\n    }\n    if (format === 'wav' && (bytes.length < 12 || bytes.subarray(0, 4).toString('ascii') !== 'RIFF' || bytes.subarray(8, 12).toString('ascii') !== 'WAVE')) {\n        throw new CommandExecutionError('MiniMax music returned bytes that are not a WAV file');\n    }\n    if (format === 'mp3' && !isMp3(bytes)) {\n        throw new CommandExecutionError('MiniMax music returned bytes that are not an MP3 file');\n    }","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/minimax/utils.js#L125-L161","documentation":"After parsing data.audio as a URL, the client requires the https: protocol. Audio links served over plain http (or ftp, file, data:, etc.) are rejected to prevent insecure downloads and accidental scheme confusion; the offending protocol is included in the message.","triggerScenarios":"MiniMax (or a mirror/proxy in region.host's CDN) returns an http:// audio link; a misconfigured base/CDN URL downgrades to http; a data: or custom scheme URL appears in the audio field.","commonSituations":"Legacy or regional MiniMax CDN endpoints still serving http; behind a corporate proxy rewriting URLs to http; test fixtures using http://example.com/audio.wav placeholders.","solutions":["Check the returned URL's protocol in the message — if it is http://, try converting to https:// and fetch manually to confirm the host supports TLS","Update the MiniMax endpoint/region configuration so the CDN returns https links","If a proxy downgrades links, bypass the proxy or configure HTTPS endpoints upstream","As a last resort, allow-list the specific http host locally and fetch over a trusted network (not recommended)"],"exampleFix":"// before: trusting API-provided URL verbatim\nconst url = requireAudioUrl(data.audio);\n// after: upgrade http to https when the host supports it\nlet audioUrl = data.audio;\nif (audioUrl.startsWith('http://')) audioUrl = 'https://' + audioUrl.slice(7);\nconst url = requireAudioUrl(audioUrl);","handlingStrategy":"validation","validationCode":"function isHttpsUrl(v) {\n  try { return new URL(v).protocol === 'https:'; } catch { return false; }\n}\nlet audio = payload?.data?.audio;\nif (typeof audio === 'string' && audio.startsWith('http://')) {\n  audio = 'https://' + audio.slice('http://'.length); // upgrade if host supports TLS\n}","typeGuard":"function isHttpsUrl(v) {\n  if (typeof v !== 'string') return false;\n  try { return new URL(v).protocol === 'https:'; } catch { return false; }\n}","tryCatchPattern":"try {\n  const url = requireAudioUrl(data.audio);\n} catch (e) {\n  const m = e.message.match(/non-HTTPS audio URL \\((\\S+)\\)/);\n  if (m && m[1] === 'http:') {\n    // retry with https-upgraded URL or fetch via a TLS-terminating proxy\n  } else throw e;\n}","preventionTips":["Prefer regions/endpoints known to serve https CDN links","Configure proxies to preserve https URLs","Sanity-check audio URL protocols in your integration tests","Never disable the https requirement in production"],"tags":["minimax","music","https","security","url"],"backgroundTag":"insecure-http-url","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}