jackwener/OpenCLI · error · CommandExecutionError

Suno generation needs ~10 credits; you have ${session.totalC

Error message

Suno generation needs ~10 credits; you have ${session.totalCreditsAvailable} (monthly ${b.monthlyRemaining}/${b.monthlyLimit} + packs ${b.purchasedPacks} + leftover ${b.pack}). Top up at ${SUNO_URL}/account.

What it means

Before submitting, suno generate verifies the account has at least ~10 credits (one generation produces 2 clips). If `session.totalCreditsAvailable` is below 10, the CLI throws with a credit breakdown and a top-up link instead of letting the API reject the request.

Source

Thrown at clis/suno/generate.js:144

            );
        }
        const deviceId = session.deviceId;
        const captcha = await checkSunoCaptcha(page, deviceId);
        if (!captcha?.ok) {
            throw new CommandExecutionError(
                `Suno captcha pre-flight failed${captcha?.status ? ` (HTTP ${captcha.status})` : ''}.`,
                `Open ${SUNO_URL}/create in Chrome and verify the account is ready, then retry.`,
            );
        }
        if (captcha?.required) {
            throw new CommandExecutionError(
                'Suno requires a CAPTCHA challenge for this account/IP right now.',
                `Open ${SUNO_URL}/create in Chrome, solve a Create challenge once, then retry.`,
            );
        }
        if (session.totalCreditsAvailable < 10) {
            const b = session.breakdown;
            throw new CommandExecutionError(
                `Suno generation needs ~10 credits; you have ${session.totalCreditsAvailable} (monthly ${b.monthlyRemaining}/${b.monthlyLimit} + packs ${b.purchasedPacks} + leftover ${b.pack}). Top up at ${SUNO_URL}/account.`,
            );
        }

        const transactionUuid = crypto.randomUUID();
        const createSessionToken = crypto.randomUUID();

        const submission = await submitSunoGeneration(page, {
            mode: isCustom ? 'custom' : 'simple',
            model,
            title,
            lyrics,
            tags,
            negativeTags,
            description,
            makeInstrumental,
            weirdness,
            styleWeight,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Top up credits or renew the subscription at https://suno.com/account, then retry.
  2. Check the breakdown in the message: monthly vs purchased packs vs leftover pack credits.
  3. If on a free plan, wait for the monthly credit refresh.
  4. Switch to an account with sufficient credits (re-login with a different Suno account).

Example fix

// before: assumes credits exist
await opencli('suno', 'generate', prompt);
// after: guard before invoking
const credits = await getCreditBalance();
if (credits < 10) throw new Error(`Need ~10 Suno credits, have ${credits}. Top up at https://suno.com/account`);
await opencli('suno', 'generate', prompt);
Defensive patterns

Strategy: validation

Validate before calling

const session = await ensureSunoSession(page);
if (session.totalCreditsAvailable < 10) {
  throw new Error(`Only ${session.totalCreditsAvailable} Suno credits — top up at https://suno.com/account before generating`);
}

Type guard

function hasCredits(session, min = 10) { return typeof session?.totalCreditsAvailable === 'number' && session.totalCreditsAvailable >= min; }

Try / catch

try {
  await opencli('suno', 'generate', prompt);
} catch (e) {
  if (/needs ~10 credits/i.test(e.message)) {
    notifyOperator('Top up Suno credits: https://suno.com/account');
    return { skipped: true, reason: 'insufficient-credits' };
  }
  throw e;
}

Prevention

When it happens

Trigger: Running `opencli suno generate` when `ensureSunoSession()` reports totalCreditsAvailable < 10, i.e. monthlyRemaining + purchasedPacks + leftover pack credits sum under 10.

Common situations: Free-plan credits exhausted for the month, forgotten subscription renewal, heavy batch generation draining credits, shared team account already spent.

Related errors


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