jackwener/OpenCLI · error · ArgumentError
minimax music must be one of
Error message
minimax music ${flag} must be one of: ${allowed.join(', ')} What it means
ArgumentError thrown by the choice() helper in the minimax music CLI. Every normalized option (model, region key, output format, audio format, sample rate/bits context) is validated against an allowed lowercase list; values outside the list are rejected with this message naming the flag and allowed values. Note the normalization lowercases and trims, so only genuinely unsupported values fail.
Solutions
- Read the allowed values from the error message and pass exactly one of them
- Check the minimax music CLI's --help or source for the current allowed lists (e.g. SAMPLE_RATES [16000,24000,32000,44100])
- Validate options in your wrapper before invoking the CLI
- Upgrade/downgrade the CLI if the allowed value set changed between versions
Example fix
// before
await music({ model: 'music-1.5', audioFormat: 'mp3' });
// after
await music({ model: 'music-01', audioFormat: 'wav' }); // use values from the allowed list in the error Defensive patterns
Strategy: validation
Validate before calling
const MODELS = ['music-01']; // check CLI source/help for the current list
if (!MODELS.includes(opts.model)) throw new Error(`model must be one of: ${MODELS.join(', ')}`); Type guard
const isOneOf = (value, allowed) => allowed.includes(String(value).trim().toLowerCase());
Try / catch
try {
await music(options);
} catch (e) {
if (String(e.message).startsWith('minimax music')) {
console.error('Invalid option:', e.message); // message lists allowed values
}
throw e;
} Prevention
- Copy allowed values directly from the error message or CLI help
- Normalize option values (trim/lowercase) in your own wrapper before calling
- Keep option docs in sync with the CLI version you deploy
- Validate config-file-driven options at startup
When it happens
Trigger: Calling the minimax music command/API with model, regionKey, outputFormat, or audioFormat set to a value not in the corresponding allowed list (e.g. model 'music-02' when only certain ids are allowed, audioFormat 'mp3' when unsupported) — either via CLI flags or programmatic options.
Common situations: Typo in the option value; copying options from an older minimax API doc; uppercase or padded values in config files (though normalization handles case/whitespace, not spelling); SDK version mismatch where allowed sets changed.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- archive search limit must be <= 100
- archive search limit must be a positive integer
- archive search mediatype must be one of
- archive search query must not be empty
- archive search sort must be one of
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/29dc1f3ba7228103.
Report an issue: GitHub.
Appendix: source
Thrown at clis/minimax/music.js:26
decodeAudioHex,
generateMusic,
parseCompletedMusic,
requireApiKey,
requireAudioUrl,
reserveAudioFile,
resolveOutputDir,
} from './utils.js';
const MODELS = ['music-3.0', 'music-2.6'];
const OUTPUT_FORMATS = ['url', 'hex'];
const AUDIO_FORMATS = ['mp3', 'wav', 'pcm'];
const SAMPLE_RATES = [16000, 24000, 32000, 44100];
const BITRATES = [32000, 64000, 128000, 256000];
function choice(value, fallback, allowed, flag) {
const normalized = String(value ?? fallback).trim().toLowerCase();
if (!allowed.includes(normalized)) {
throw new ArgumentError(`minimax music ${flag} must be one of: ${allowed.join(', ')}`);
}
return normalized;
}
function boolean(value, flag) {
if (value == null || value === '') return false;
if (typeof value === 'boolean') return value;
if (value === 'true' || value === '1') return true;
if (value === 'false' || value === '0') return false;
throw new ArgumentError(`minimax music ${flag} must be true or false`);
}
function optionalInteger(value, allowed, flag) {
if (value == null || value === '') return null;
const parsed = Number(value);
if (!Number.isInteger(parsed) || !allowed.includes(parsed)) {
throw new ArgumentError(`minimax music ${flag} must be one of: ${allowed.join(', ')}`);
}View on GitHub (pinned to 49907e53dc)