{"record":{"id":"fda0219d7d9f6c34","repo":"jackwener/OpenCLI","slug":"minimax-music-flag-must-be-an-integer-from-mi","errorCode":null,"errorMessage":"minimax music ${flag} must be an integer from ${min} to ${max}","messagePattern":"minimax music (.+?) must be an integer from (.+?) to (.+?)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/minimax/music.js","lineNumber":51,"sourceCode":"    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}\n\nfunction text(value, max, flag) {\n    const normalized = String(value ?? '').trim();\n    if (normalized.length > max) throw new ArgumentError(`minimax music ${flag} must be at most ${max} characters`);\n    return normalized;\n}\n\ncli({\n    site: 'minimax',\n    name: 'music',\n    access: 'write',\n    description: 'Generate music for legacy paid MiniMax Music API accounts',\n    domain: 'api.minimax.io',\n    strategy: Strategy.PUBLIC,\n    browser: false,","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/minimax/music.js#L33-L69","documentation":"boundedInteger validates --timeout-seconds: it coerces the value (or its fallback) with Number() and requires an integer within [min, max]. Non-integers or out-of-range values throw this ArgumentError naming the allowed range.","triggerScenarios":"--timeout-seconds 2.5 (non-integer), --timeout-seconds 0 or --timeout-seconds 9999 (outside min/max), or a value like '30s'/'thirty' that Number() can't turn into an integer.","commonSituations":"Users adapting timeout values written with units in other tools; scripts computing fractional timeouts (e.g. seconds from milliseconds without rounding); guessing a max timeout larger than the CLI allows.","solutions":["Pass a whole number inside the stated range, e.g. --timeout-seconds 60","Parse the min/max from the error message ('must be an integer from X to Y') and clamp your value","Round/ceil any computed timeout to an integer before invoking","If you need a longer timeout, check whether the CLI's max constant can be raised in a newer version"],"exampleFix":"// before\nminimax music --lyrics \"...\" --timeout-seconds 2.5\n// after\nminimax music --lyrics \"...\" --timeout-seconds 30","handlingStrategy":"validation","validationCode":"function assertBoundedInt(value, min, max, name) {\n  const n = Number(value);\n  if (!Number.isInteger(n) || n < min || n > max)\n    throw new Error(`${name} must be an integer from ${min} to ${max}`);\n}\nassertBoundedInt(opts.timeoutSeconds, 1, 300, '--timeout-seconds'); // adjust bounds to CLI's","typeGuard":null,"tryCatchPattern":"try {\n  runMinimaxMusic(args);\n} catch (e) {\n  const m = e.message.match(/--?(\\S+) must be an integer from (\\d+) to (\\d+)/);\n  if (m) {\n    console.error(`Clamp --${m[1]} to [${m[2]}, ${m[3]}]`);\n    process.exitCode = 2;\n  } else throw e;\n}","preventionTips":["Round computed timeouts to whole numbers before passing them","Strip units from values coming from other tools before mapping them to this flag","Check the exact min/max in clis/minimax/music.js rather than guessing","Keep timeout defaults in one config constant shared by all scripts"],"tags":["cli","minimax","argument-validation","range-check"],"backgroundTag":"invalid-flag-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}