{"record":{"id":"b8ad9c783b2a68c0","repo":"jackwener/OpenCLI","slug":"minimax-music-flag-must-be-true-or-false","errorCode":null,"errorMessage":"minimax music ${flag} must be true or false","messagePattern":"minimax music (.+?) must be true or false","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/minimax/music.js","lineNumber":36,"sourceCode":"const OUTPUT_FORMATS = ['url', 'hex'];\nconst AUDIO_FORMATS = ['mp3', 'wav', 'pcm'];\nconst SAMPLE_RATES = [16000, 24000, 32000, 44100];\nconst BITRATES = [32000, 64000, 128000, 256000];\n\nfunction choice(value, fallback, allowed, flag) {\n    const normalized = String(value ?? fallback).trim().toLowerCase();\n    if (!allowed.includes(normalized)) {\n        throw new ArgumentError(`minimax music ${flag} must be one of: ${allowed.join(', ')}`);\n    }\n    return normalized;\n}\n\nfunction boolean(value, flag) {\n    if (value == null || value === '') return false;\n    if (typeof value === 'boolean') return value;\n    if (value === 'true' || value === '1') return true;\n    if (value === 'false' || value === '0') return false;\n    throw new ArgumentError(`minimax music ${flag} must be true or false`);\n}\n\nfunction optionalInteger(value, allowed, flag) {\n    if (value == null || value === '') return null;\n    const parsed = Number(value);\n    if (!Number.isInteger(parsed) || !allowed.includes(parsed)) {\n        throw new ArgumentError(`minimax music ${flag} must be one of: ${allowed.join(', ')}`);\n    }\n    return parsed;\n}\n\nfunction boundedInteger(value, fallback, min, max, flag) {\n    const parsed = Number(value ?? fallback);\n    if (!Number.isInteger(parsed) || parsed < min || parsed > max) {\n        throw new ArgumentError(`minimax music ${flag} must be an integer from ${min} to ${max}`);\n    }\n    return parsed;\n}","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/minimax/music.js#L18-L54","documentation":"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.","triggerScenarios":"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'.","commonSituations":"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.","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"],"exampleFix":"// before\nminimax music --instrumental yes --prompt \"lofi beats\"\n// after\nminimax music --instrumental true --prompt \"lofi beats\"","handlingStrategy":"validation","validationCode":"function parseBoolFlag(v) {\n  if (v == null || v === '') return false;\n  if (typeof v === 'boolean') return v;\n  if (v === 'true' || v === '1') return true;\n  if (v === 'false' || v === '0') return false;\n  throw new Error(`flag value ${JSON.stringify(v)} must be true/false/1/0`);\n}\n// run parseBoolFlag(process.env.INSTRUMENTAL) before invoking the CLI","typeGuard":null,"tryCatchPattern":"try {\n  runMinimaxMusic(args);\n} catch (e) {\n  if (/must be true or false/.test(e.message)) {\n    console.error(`Bad boolean flag: ${e.message}. Use true/false or 1/0.`);\n    process.exitCode = 2;\n  } else throw e;\n}","preventionTips":["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"],"tags":["cli","minimax","argument-validation","boolean-flag"],"backgroundTag":"invalid-flag-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}