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
- Add --output-format hex to the invocation when using --op
- Or remove --op if you only want the default response format
- Verify the resolved outputFormat in your wrapper before appending --op
- 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
- Always pair --op with --output-format hex in templates
- Don't set --op unconditionally in shared wrappers
- Keep output dir and output format together in one config object
- Verify flags with a dry run before --execute
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
- minimax music ${flag} must be one of: ${allowed.join(', ')}
- minimax music ${flag} must be true or false
- minimax music ${flag} must be an integer from ${min} to ${ma
- minimax music ${flag} must be at most ${max} characters
- minimax music --instrumental requires prompt and cannot be c
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/834bf30d0355a128.
Report an issue: GitHub.