{"record":{"id":"29dc1f3ba7228103","repo":"jackwener/OpenCLI","slug":"minimax-music-flag-must-be-one-of-allowed-jo","errorCode":null,"errorMessage":"minimax music ${flag} must be one of: ${allowed.join(', ')}","messagePattern":"minimax music (.+?) must be one of: (.+?)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/minimax/music.js","lineNumber":26,"sourceCode":"    decodeAudioHex,\n    generateMusic,\n    parseCompletedMusic,\n    requireApiKey,\n    requireAudioUrl,\n    reserveAudioFile,\n    resolveOutputDir,\n} from './utils.js';\n\nconst MODELS = ['music-3.0', 'music-2.6'];\nconst 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    }","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/minimax/music.js#L8-L44","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nawait music({ model: 'music-1.5', audioFormat: 'mp3' });\n// after\nawait music({ model: 'music-01', audioFormat: 'wav' }); // use values from the allowed list in the error","handlingStrategy":"validation","validationCode":"const MODELS = ['music-01']; // check CLI source/help for the current list\nif (!MODELS.includes(opts.model)) throw new Error(`model must be one of: ${MODELS.join(', ')}`);","typeGuard":"const isOneOf = (value, allowed) => allowed.includes(String(value).trim().toLowerCase());","tryCatchPattern":"try {\n  await music(options);\n} catch (e) {\n  if (String(e.message).startsWith('minimax music')) {\n    console.error('Invalid option:', e.message); // message lists allowed values\n  }\n  throw e;\n}","preventionTips":["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"],"tags":["validation","argument-error","minimax","cli"],"backgroundTag":"invalid-argument-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}