{"record":{"id":"33e38e97b9e261a2","repo":"jackwener/OpenCLI","slug":"suno-generation-needs-10-credits-you-have-sess","errorCode":null,"errorMessage":"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.","messagePattern":"Suno generation needs ~10 credits; you have (.+?) \\(monthly (.+?)/(.+?) \\+ packs (.+?) \\+ leftover (.+?)\\)\\. Top up at (.+?)/account\\.","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/suno/generate.js","lineNumber":144,"sourceCode":"            );\n        }\n        const deviceId = session.deviceId;\n        const captcha = await checkSunoCaptcha(page, deviceId);\n        if (!captcha?.ok) {\n            throw new CommandExecutionError(\n                `Suno captcha pre-flight failed${captcha?.status ? ` (HTTP ${captcha.status})` : ''}.`,\n                `Open ${SUNO_URL}/create in Chrome and verify the account is ready, then retry.`,\n            );\n        }\n        if (captcha?.required) {\n            throw new CommandExecutionError(\n                'Suno requires a CAPTCHA challenge for this account/IP right now.',\n                `Open ${SUNO_URL}/create in Chrome, solve a Create challenge once, then retry.`,\n            );\n        }\n        if (session.totalCreditsAvailable < 10) {\n            const b = session.breakdown;\n            throw new CommandExecutionError(\n                `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.`,\n            );\n        }\n\n        const transactionUuid = crypto.randomUUID();\n        const createSessionToken = crypto.randomUUID();\n\n        const submission = await submitSunoGeneration(page, {\n            mode: isCustom ? 'custom' : 'simple',\n            model,\n            title,\n            lyrics,\n            tags,\n            negativeTags,\n            description,\n            makeInstrumental,\n            weirdness,\n            styleWeight,","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/suno/generate.js#L126-L162","documentation":"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.","triggerScenarios":"Running `opencli suno generate` when `ensureSunoSession()` reports totalCreditsAvailable < 10, i.e. monthlyRemaining + purchasedPacks + leftover pack credits sum under 10.","commonSituations":"Free-plan credits exhausted for the month, forgotten subscription renewal, heavy batch generation draining credits, shared team account already spent.","solutions":["Top up credits or renew the subscription at https://suno.com/account, then retry.","Check the breakdown in the message: monthly vs purchased packs vs leftover pack credits.","If on a free plan, wait for the monthly credit refresh.","Switch to an account with sufficient credits (re-login with a different Suno account)."],"exampleFix":"// before: assumes credits exist\nawait opencli('suno', 'generate', prompt);\n// after: guard before invoking\nconst credits = await getCreditBalance();\nif (credits < 10) throw new Error(`Need ~10 Suno credits, have ${credits}. Top up at https://suno.com/account`);\nawait opencli('suno', 'generate', prompt);","handlingStrategy":"validation","validationCode":"const session = await ensureSunoSession(page);\nif (session.totalCreditsAvailable < 10) {\n  throw new Error(`Only ${session.totalCreditsAvailable} Suno credits — top up at https://suno.com/account before generating`);\n}","typeGuard":"function hasCredits(session, min = 10) { return typeof session?.totalCreditsAvailable === 'number' && session.totalCreditsAvailable >= min; }","tryCatchPattern":"try {\n  await opencli('suno', 'generate', prompt);\n} catch (e) {\n  if (/needs ~10 credits/i.test(e.message)) {\n    notifyOperator('Top up Suno credits: https://suno.com/account');\n    return { skipped: true, reason: 'insufficient-credits' };\n  }\n  throw e;\n}","preventionTips":["Check credit balance before each batch job, not after failures.","Track monthly credit reset dates on free plans.","Alert when balance drops below ~20 credits to leave headroom.","Dedicate an account with a paid plan for automation."],"tags":["quota","credits","billing"],"backgroundTag":"insufficient-quota","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}