{"record":{"id":"834bf30d0355a128","repo":"jackwener/OpenCLI","slug":"minimax-music-op-requires-output-format-hex","errorCode":null,"errorMessage":"minimax music --op requires --output-format hex","messagePattern":"minimax music --op requires --output-format hex","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/minimax/music.js","lineNumber":115,"sourceCode":"        const aigcWatermark = boolean(kwargs['aigc-watermark'], '--aigc-watermark');\n        const execute = boolean(kwargs.execute, '--execute');\n        const prompt = text(kwargs.prompt, 2000, 'prompt');\n        const lyrics = text(kwargs.lyrics, 3500, '--lyrics');\n\n        if (instrumental && (!prompt || lyrics || lyricsOptimizer)) {\n            throw new ArgumentError('minimax music --instrumental requires prompt and cannot be combined with --lyrics or --lyrics-optimizer');\n        }\n        if (lyricsOptimizer && (!prompt || lyrics)) {\n            throw new ArgumentError('minimax music --lyrics-optimizer requires prompt and cannot be combined with --lyrics');\n        }\n        if (!instrumental && !lyrics && !lyricsOptimizer) {\n            throw new ArgumentError('minimax music vocal generation requires --lyrics, or prompt with --lyrics-optimizer');\n        }\n        if (aigcWatermark && regionKey !== 'cn') {\n            throw new ArgumentError('minimax music --aigc-watermark is only supported with --region cn');\n        }\n        if (kwargs.op != null && outputFormat !== 'hex') {\n            throw new ArgumentError('minimax music --op requires --output-format hex');\n        }\n        const outputDir = outputFormat === 'hex' ? resolveOutputDir(kwargs.op) : null;\n        if (!execute) throw new ArgumentError('Refusing to spend MiniMax quota without --execute');\n\n        const region = MUSIC_REGIONS[regionKey];\n        const apiKey = requireApiKey();\n        const reservation = outputFormat === 'hex' ? reserveAudioFile(outputDir, model, audioFormat) : null;\n        let committed = false;\n        try {\n            const payload = await generateMusic(region, apiKey, buildRequest({\n                model, prompt, lyrics, outputFormat, audioFormat, sampleRate, bitrate,\n                instrumental, lyricsOptimizer, aigcWatermark,\n            }), timeoutSeconds);\n            const completed = parseCompletedMusic(payload, region);\n            let audioUrl = null;\n            let file = null;\n            if (outputFormat === 'url') {\n                audioUrl = requireAudioUrl(completed.audio);","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/minimax/music.js#L97-L133","documentation":"--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.","triggerScenarios":"--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.","commonSituations":"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.","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"],"exampleFix":"// before\nminimax music --lyrics \"...\" --execute --op ./audio\n// after\nminimax music --lyrics \"...\" --execute --op ./audio --output-format hex","handlingStrategy":"validation","validationCode":"if (opts.op != null && opts.outputFormat !== 'hex') {\n  throw new Error('--op requires --output-format hex');\n} // run before invoking the CLI","typeGuard":null,"tryCatchPattern":"try {\n  runMinimaxMusic(args);\n} catch (e) {\n  if (e.message.includes('--op requires --output-format hex')) {\n    console.error('Add --output-format hex alongside --op, or drop --op');\n    process.exitCode = 2;\n  } else throw e;\n}","preventionTips":["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"],"tags":["cli","minimax","flag-dependency","output-format"],"backgroundTag":"missing-required-flag","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}