{"record":{"id":"0c559295ce460252","repo":"jackwener/OpenCLI","slug":"refusing-to-spend-minimax-quota-without-execute","errorCode":null,"errorMessage":"Refusing to spend MiniMax quota without --execute","messagePattern":"Refusing to spend MiniMax quota without --execute","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"warning","filePath":"clis/minimax/music.js","lineNumber":118,"sourceCode":"        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);\n            } else {\n                file = commitAudioFile(reservation, decodeAudioHex(completed.audio, completed.expectedBytes, audioFormat));\n                committed = true;","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/minimax/music.js#L100-L136","documentation":"Music generation consumes paid MiniMax quota, so the CLI is dry-run by default: it performs all validation and then refuses to call the API unless --execute (parsed via boolean()) is true. Without it, the CLI throws this ArgumentError as a cost guard.","triggerScenarios":"Running the command fully valid but without --execute; --execute false or --execute 0; an unset/empty EXECUTE variable in a wrapper resolving to false.","commonSituations":"Testing invocations to check validation and being surprised the API wasn't called; CI jobs where the execute flag was omitted for safety; users migrating from other CLIs that execute by default.","solutions":["Add --execute true (or --execute 1) once you've verified the dry-run output and accept the quota cost","If you intended a dry run, this error is expected behavior — treat it as confirmation nothing was charged","Ensure wrapper scripts forward the EXECUTE variable instead of dropping it","Keep a two-step workflow: run without --execute to preview, then rerun with --execute true"],"exampleFix":"// before\nminimax music --lyrics \"...\" --prompt \"...\"\n// after\nminimax music --lyrics \"...\" --prompt \"...\" --execute true","handlingStrategy":"validation","validationCode":"if (!parseBoolFlag(opts.execute)) {\n  console.warn('Dry run: nothing will be generated. Add --execute true to spend MiniMax quota.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  runMinimaxMusic(args);\n} catch (e) {\n  if (e.message.includes('Refusing to spend MiniMax quota')) {\n    console.error('Dry run completed with no errors. Re-run with --execute true to generate.');\n    process.exitCode = 0; // treat as expected for dry runs\n  } else throw e;\n}","preventionTips":["Treat a run without --execute as an intentional dry run, not a failure","Forward the execute flag explicitly in CI and wrapper scripts","Preview with a dry run first, then add --execute true once validated","Standardize a two-step run/confirm workflow in your team's tooling"],"tags":["cli","minimax","dry-run-guard","cost-protection"],"backgroundTag":"dry-run-guard-required","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}