jackwener/OpenCLI · error · CommandExecutionError

MiniMax music returned a non-HTTPS audio URL (${url.protocol

Error message

MiniMax music returned a non-HTTPS audio URL (${url.protocol})

What it means

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.

Source

Thrown at clis/minimax/utils.js:143

    if (!extraInfo || typeof extraInfo !== 'object' || Array.isArray(extraInfo)) {
        throw new CommandExecutionError('MiniMax music returned malformed extra_info');
    }
    if (extraInfo.music_size == null) return null;
    if (!Number.isSafeInteger(extraInfo.music_size) || extraInfo.music_size <= 0) {
        throw new CommandExecutionError('MiniMax music returned invalid extra_info.music_size');
    }
    return extraInfo.music_size;
}

export function requireAudioUrl(value) {
    let url;
    try {
        url = new URL(value);
    } catch {
        throw new CommandExecutionError('MiniMax music returned data.audio that is not a URL');
    }
    if (url.protocol !== 'https:') {
        throw new CommandExecutionError(`MiniMax music returned a non-HTTPS audio URL (${url.protocol})`);
    }
    return url.toString();
}

export function decodeAudioHex(value, expectedBytes, format) {
    if (value.length === 0 || value.length % 2 !== 0 || !/^[0-9a-f]+$/i.test(value)) {
        throw new CommandExecutionError('MiniMax music returned invalid hexadecimal audio');
    }
    const bytes = Buffer.from(value, 'hex');
    if (expectedBytes != null && bytes.length !== expectedBytes) {
        throw new CommandExecutionError(`MiniMax music audio size mismatch (expected ${expectedBytes} bytes, got ${bytes.length})`);
    }
    if (format === 'wav' && (bytes.length < 12 || bytes.subarray(0, 4).toString('ascii') !== 'RIFF' || bytes.subarray(8, 12).toString('ascii') !== 'WAVE')) {
        throw new CommandExecutionError('MiniMax music returned bytes that are not a WAV file');
    }
    if (format === 'mp3' && !isMp3(bytes)) {
        throw new CommandExecutionError('MiniMax music returned bytes that are not an MP3 file');
    }

View on GitHub (pinned to 49907e53dc)

Solutions

  1. 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
  2. Update the MiniMax endpoint/region configuration so the CDN returns https links
  3. If a proxy downgrades links, bypass the proxy or configure HTTPS endpoints upstream
  4. As a last resort, allow-list the specific http host locally and fetch over a trusted network (not recommended)

Example fix

// before: trusting API-provided URL verbatim
const url = requireAudioUrl(data.audio);
// after: upgrade http to https when the host supports it
let audioUrl = data.audio;
if (audioUrl.startsWith('http://')) audioUrl = 'https://' + audioUrl.slice(7);
const url = requireAudioUrl(audioUrl);
Defensive patterns

Strategy: validation

Validate before calling

function isHttpsUrl(v) {
  try { return new URL(v).protocol === 'https:'; } catch { return false; }
}
let audio = payload?.data?.audio;
if (typeof audio === 'string' && audio.startsWith('http://')) {
  audio = 'https://' + audio.slice('http://'.length); // upgrade if host supports TLS
}

Type guard

function isHttpsUrl(v) {
  if (typeof v !== 'string') return false;
  try { return new URL(v).protocol === 'https:'; } catch { return false; }
}

Try / catch

try {
  const url = requireAudioUrl(data.audio);
} catch (e) {
  const m = e.message.match(/non-HTTPS audio URL \((\S+)\)/);
  if (m && m[1] === 'http:') {
    // retry with https-upgraded URL or fetch via a TLS-terminating proxy
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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