jackwener/OpenCLI · error · ArgumentError
minimax music ${flag} must be true or false
Error message
minimax music ${flag} must be true or false What it means
The MiniMax music CLI parses --instrumental, --lyrics-optimizer and --aigc-watermark through boolean(), which only accepts true/false, 1/0, null/'' (meaning absent). Any other value (e.g. 'yes', 'on', 'TRUE', whitespace) makes the parser throw this ArgumentError so invalid flag values never reach the API.
Source
Thrown at clis/minimax/music.js:36
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(', ')}`);
}
return parsed;
}
function boundedInteger(value, fallback, min, max, flag) {
const parsed = Number(value ?? fallback);
if (!Number.isInteger(parsed) || parsed < min || parsed > max) {
throw new ArgumentError(`minimax music ${flag} must be an integer from ${min} to ${max}`);
}
return parsed;
}View on GitHub (pinned to 49907e53dc)
Solutions
- Use exactly true/false or 1/0 for the flag, e.g. --instrumental true or --aigc-watermark 0
- Omit the flag entirely if you want it disabled (absent parses to false)
- Inspect the error message: ${flag} names the offending option, fix only that one
- If reading from config/env, normalize with a small parser before invoking the CLI
Example fix
// before minimax music --instrumental yes --prompt "lofi beats" // after minimax music --instrumental true --prompt "lofi beats"
Defensive patterns
Strategy: validation
Validate before calling
function parseBoolFlag(v) {
if (v == null || v === '') return false;
if (typeof v === 'boolean') return v;
if (v === 'true' || v === '1') return true;
if (v === 'false' || v === '0') return false;
throw new Error(`flag value ${JSON.stringify(v)} must be true/false/1/0`);
}
// run parseBoolFlag(process.env.INSTRUMENTAL) before invoking the CLI Try / catch
try {
runMinimaxMusic(args);
} catch (e) {
if (/must be true or false/.test(e.message)) {
console.error(`Bad boolean flag: ${e.message}. Use true/false or 1/0.`);
process.exitCode = 2;
} else throw e;
} Prevention
- Only ever pass true/false/1/0 for --instrumental, --lyrics-optimizer, --aigc-watermark, --execute
- Omit boolean flags instead of passing 'no'/'off' to disable them
- Centralize flag construction in one wrapper function rather than ad-hoc shell strings
- Quote values in shell to avoid word-splitting producing stray tokens
When it happens
Trigger: Passing a value other than true/false/1/0 to one of the boolean flags: --instrumental yes, --lyrics-optimizer=on, --aigc-watermark TRUE, or a quoted/empty-ish string that trims to something unparseable; also calling boolean() programmatically with e.g. 2 or 'enabled'.
Common situations: Shell scripts built from templates where a variable substitutes 'YES' or 'no'; YAML/JSON config where booleans were written as 'enabled'/'disabled'; users copying Unix-style --flag=value conventions; environment-variable expansion turning an unset var into a stray word.
Related errors
- minimax music ${flag} must be an integer from ${min} to ${ma
- minimax music ${flag} must be at most ${max} characters
- <train-no> "${trainNo}" does not look like a 12306 internal
- --from station must not be empty
- --to station must not be empty
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/b8ad9c783b2a68c0.
Report an issue: GitHub.