jackwener/OpenCLI · error · ArgumentError

minimax music ${flag} must be an integer from ${min} to ${ma

Error message

minimax music ${flag} must be an integer from ${min} to ${max}

What it means

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.

Source

Thrown at clis/minimax/music.js:51

    if (typeof value === 'boolean') return value;
    if (value === 'true' || value === '1') return true;
    if (value === 'false' || value === '0') return false;
    throw new ArgumentError(`minimax music ${flag} must be true or false`);
}

function optionalInteger(value, allowed, flag) {
    if (value == null || value === '') return null;
    const parsed = Number(value);
    if (!Number.isInteger(parsed) || !allowed.includes(parsed)) {
        throw new ArgumentError(`minimax music ${flag} must be one of: ${allowed.join(', ')}`);
    }
    return parsed;
}

function boundedInteger(value, fallback, min, max, flag) {
    const parsed = Number(value ?? fallback);
    if (!Number.isInteger(parsed) || parsed < min || parsed > max) {
        throw new ArgumentError(`minimax music ${flag} must be an integer from ${min} to ${max}`);
    }
    return parsed;
}

function text(value, max, flag) {
    const normalized = String(value ?? '').trim();
    if (normalized.length > max) throw new ArgumentError(`minimax music ${flag} must be at most ${max} characters`);
    return normalized;
}

cli({
    site: 'minimax',
    name: 'music',
    access: 'write',
    description: 'Generate music for legacy paid MiniMax Music API accounts',
    domain: 'api.minimax.io',
    strategy: Strategy.PUBLIC,
    browser: false,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Pass a whole number inside the stated range, e.g. --timeout-seconds 60
  2. Parse the min/max from the error message ('must be an integer from X to Y') and clamp your value
  3. Round/ceil any computed timeout to an integer before invoking
  4. If you need a longer timeout, check whether the CLI's max constant can be raised in a newer version

Example fix

// before
minimax music --lyrics "..." --timeout-seconds 2.5
// after
minimax music --lyrics "..." --timeout-seconds 30
Defensive patterns

Strategy: validation

Validate before calling

function assertBoundedInt(value, min, max, name) {
  const n = Number(value);
  if (!Number.isInteger(n) || n < min || n > max)
    throw new Error(`${name} must be an integer from ${min} to ${max}`);
}
assertBoundedInt(opts.timeoutSeconds, 1, 300, '--timeout-seconds'); // adjust bounds to CLI's

Try / catch

try {
  runMinimaxMusic(args);
} catch (e) {
  const m = e.message.match(/--?(\S+) must be an integer from (\d+) to (\d+)/);
  if (m) {
    console.error(`Clamp --${m[1]} to [${m[2]}, ${m[3]}]`);
    process.exitCode = 2;
  } else throw e;
}

Prevention

When it happens

Trigger: --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.

Common situations: 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.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/fda0219d7d9f6c34. Report an issue: GitHub.