jackwener/OpenCLI · error · ArgumentError

minimax music --op requires --output-format hex

Error message

minimax music --op requires --output-format hex

What it means

--op specifies an output directory for writing generated audio files to disk, and the CLI only supports this in combination with --output-format hex (the format that returns audio bytes/paths it can save). Any other output format with --op throws this ArgumentError.

Source

Thrown at clis/minimax/music.js:115

        const aigcWatermark = boolean(kwargs['aigc-watermark'], '--aigc-watermark');
        const execute = boolean(kwargs.execute, '--execute');
        const prompt = text(kwargs.prompt, 2000, 'prompt');
        const lyrics = text(kwargs.lyrics, 3500, '--lyrics');

        if (instrumental && (!prompt || lyrics || lyricsOptimizer)) {
            throw new ArgumentError('minimax music --instrumental requires prompt and cannot be combined with --lyrics or --lyrics-optimizer');
        }
        if (lyricsOptimizer && (!prompt || lyrics)) {
            throw new ArgumentError('minimax music --lyrics-optimizer requires prompt and cannot be combined with --lyrics');
        }
        if (!instrumental && !lyrics && !lyricsOptimizer) {
            throw new ArgumentError('minimax music vocal generation requires --lyrics, or prompt with --lyrics-optimizer');
        }
        if (aigcWatermark && regionKey !== 'cn') {
            throw new ArgumentError('minimax music --aigc-watermark is only supported with --region cn');
        }
        if (kwargs.op != null && outputFormat !== 'hex') {
            throw new ArgumentError('minimax music --op requires --output-format hex');
        }
        const outputDir = outputFormat === 'hex' ? resolveOutputDir(kwargs.op) : null;
        if (!execute) throw new ArgumentError('Refusing to spend MiniMax quota without --execute');

        const region = MUSIC_REGIONS[regionKey];
        const apiKey = requireApiKey();
        const reservation = outputFormat === 'hex' ? reserveAudioFile(outputDir, model, audioFormat) : null;
        let committed = false;
        try {
            const payload = await generateMusic(region, apiKey, buildRequest({
                model, prompt, lyrics, outputFormat, audioFormat, sampleRate, bitrate,
                instrumental, lyricsOptimizer, aigcWatermark,
            }), timeoutSeconds);
            const completed = parseCompletedMusic(payload, region);
            let audioUrl = null;
            let file = null;
            if (outputFormat === 'url') {
                audioUrl = requireAudioUrl(completed.audio);

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Add --output-format hex to the invocation when using --op
  2. Or remove --op if you only want the default response format
  3. Verify the resolved outputFormat in your wrapper before appending --op
  4. Check resolveOutputDir usage in clis/minimax/music.js to confirm the hex+op contract

Example fix

// before
minimax music --lyrics "..." --execute --op ./audio
// after
minimax music --lyrics "..." --execute --op ./audio --output-format hex
Defensive patterns

Strategy: validation

Validate before calling

if (opts.op != null && opts.outputFormat !== 'hex') {
  throw new Error('--op requires --output-format hex');
} // run before invoking the CLI

Try / catch

try {
  runMinimaxMusic(args);
} catch (e) {
  if (e.message.includes('--op requires --output-format hex')) {
    console.error('Add --output-format hex alongside --op, or drop --op');
    process.exitCode = 2;
  } else throw e;
}

Prevention

When it happens

Trigger: --op ./audio with --output-format json/url/default; passing --op while relying on the default output format; scripts setting --op unconditionally without setting the format.

Common situations: Reusing a command template that sets --op but whose --output-format hex was dropped during editing; users expecting file output by default; mixing flags from two different CLI examples.

Related errors


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