{"record":{"id":"c577b4b648a821ab","repo":"jackwener/OpenCLI","slug":"suno-session-check-failed-detail","errorCode":null,"errorMessage":"Suno session check failed (${detail}).","messagePattern":"Suno session check failed \\((.+?)\\)\\.","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/suno/utils.js","lineNumber":209,"sourceCode":"            let data = null;\n            try {\n                data = await res.json();\n            } catch (e) {\n                return { ok: false, error: 'Malformed billing/info JSON: ' + String(e).slice(0, 200) };\n            }\n            const parse = ${parseSunoBillingInfo.toString()};\n            return { ok: true, ...parse(data) };\n        } catch (e) {\n            return { ok: false, error: String(e).slice(0, 200) };\n        }\n    })()`));\n\n    if (!result || !result.ok) {\n        const detail = result?.status || result?.error || 'unknown';\n        if (result?.auth || result?.status === 401 || result?.status === 403) {\n            throw new AuthRequiredError(SUNO_DOMAIN, `Suno session check failed (${detail}). Open https://suno.com in Chrome and sign in, then retry.`);\n        }\n        throw new CommandExecutionError(`Suno session check failed (${detail}).`);\n    }\n    return { ...result, deviceId };\n}\n\n/**\n * Verify the captcha pre-flight. If `required:true`, the simple flow won't\n * work without solving a CAPTCHA (out of scope for the headless adapter).\n */\nexport async function checkSunoCaptcha(page, deviceId) {\n    const result = unwrapEvaluateResult(await page.evaluate(`(async () => {\n        const res = await fetch('${STUDIO_API}/api/c/check', {\n            method: 'POST',\n            headers: ${sunoHeadersJs(deviceId, { 'Content-Type': 'application/json' })},\n            body: JSON.stringify({ ctype: 'generation' }),\n        });\n        if (!res.ok) return { ok: false, status: res.status };\n        return { ok: true, ...(await res.json()) };\n    })()`));","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/suno/utils.js#L191-L227","documentation":"ensureSunoSession throws this generic CommandExecutionError when the session pre-flight fails for a non-auth reason: the in-page check returned ok:false without a 401/403 or auth flag. `detail` carries the status or error string returned by the browser-side fetch.","triggerScenarios":"The browser-side fetch to suno.com fails due to network errors, a non-auth HTTP status (429, 5xx), Cloudflare/anti-bot interstitials, or a page context error (Clerk object missing because the page didn't load correctly) — any failure that isn't clearly an auth rejection.","commonSituations":"Offline or flaky network; suno.com partially down or rate-limiting (HTTP 429); a captcha/Cloudflare challenge page replacing the app so `window.Clerk` is undefined; corporate proxy blocking studio-api requests.","solutions":["Retry the command after a short wait — transient network or 5xx/429 conditions often clear.","Open https://suno.com in the controlled Chrome tab and complete any captcha/Cloudflare challenge so the real app (and window.Clerk) loads.","Check network/proxy connectivity to suno.com and studio-api-prod.suno.com.","Verify the browser page loaded suno.com fully (no error page); reload the tab and retry.","If detail shows 429, slow down — wait for the rate-limit window before retrying."],"exampleFix":"// before (running while a Cloudflare challenge page is loaded)\nopencli suno status   // -> Suno session check failed (malformed clips payload).\n// after (complete the challenge / reload the app page in Chrome, then)\nopencli suno status","handlingStrategy":"retry","validationCode":"// Pre-flight: check network reachability and a fully-loaded suno.com app\nconst reachable = await fetch('https://suno.com', { method: 'HEAD' }).then(r => r.ok).catch(() => false);\nif (!reachable) throw new Error('suno.com unreachable — check network/proxy');","typeGuard":"function isTransientSessionFailure(err) {\n  return err && !/sign in/i.test(err.message || '') && /session check failed/i.test(err.message || '');\n}","tryCatchPattern":"for (let attempt = 1; attempt <= 3; attempt++) {\n  try { await ensureSunoSession(page, deviceId); break; }\n  catch (err) {\n    if (err.name === 'AuthRequiredError') throw err; // not transient\n    if (attempt === 3) throw err;\n    await new Promise(r => setTimeout(r, attempt * 2000));\n  }\n}","preventionTips":["Retry with backoff for 429/5xx/non-auth failures.","Complete any Cloudflare/captcha challenge in the browser tab before running commands.","Check proxy/firewall access to suno.com and studio-api-prod.suno.com.","Reload the suno.com tab if window.Clerk is missing."],"tags":["network","suno","browser-automation","session"],"backgroundTag":"api-request-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}