{"record":{"id":"52f7b50ebcf3d3d1","repo":"jackwener/OpenCLI","slug":"suno-feed-lookup-failed-http-result-status","errorCode":null,"errorMessage":"Suno feed lookup failed (HTTP ${result?.status || '?'}).","messagePattern":"Suno feed lookup failed \\(HTTP (.+?)\\)\\.","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/suno/list.js","lineNumber":56,"sourceCode":"        const deviceId = session.deviceId;\n\n        const result = unwrapEvaluateResult(await page.evaluate(`(async () => {\n            const browserToken = JSON.stringify({ token: btoa(JSON.stringify({ timestamp: Date.now() })) });\n            const res = await fetch('${STUDIO_API}/api/feed/v2?page=${pageOffset}', {\n                headers: {\n                    'Authorization': 'Bearer ' + (await window.Clerk.session.getToken()),\n                    'browser-token': browserToken,\n                    'device-id': ${JSON.stringify(deviceId)},\n                },\n            });\n            if (!res.ok) return { ok: false, status: res.status };\n            const data = await res.json().catch(() => null);\n            if (!data || !Array.isArray(data.clips)) return { ok: false, error: 'malformed clips payload' };\n            return { ok: true, clips: data.clips };\n        })()`));\n\n        if (!result?.ok) {\n            throw new CommandExecutionError(result?.error || `Suno feed lookup failed (HTTP ${result?.status || '?'}).`);\n        }\n        if (!Array.isArray(result.clips)) {\n            throw new CommandExecutionError('Suno feed lookup returned malformed clips payload');\n        }\n        if (result.clips.length === 0) {\n            throw new EmptyResultError('suno list', 'No Suno clips found in your library.');\n        }\n\n        return result.clips.slice(0, limit).map((c, i) => {\n            if (!c || typeof c.id !== 'string' || !c.id) {\n                throw new CommandExecutionError('Suno feed lookup returned malformed clip identity');\n            }\n            return {\n                rank: i + 1 + pageOffset * limit,\n                clip: c.id.slice(0, 8),\n                title: c.title || '(untitled)',\n                status: c.status || '?',\n                created: (c.created_at || '').replace('T', ' ').replace(/\\..*$/, '').replace(/Z$/, ''),","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/suno/list.js#L38-L74","documentation":"`opencli suno list` fetches the /api/feed/v2 feed inside the browser page. If the result is not ok and carries no specific error, the CLI throws with the HTTP status (or '?'). This covers non-2xx responses and any other failed fetch outcome.","triggerScenarios":"The in-page fetch to `${STUDIO_API}/api/feed/v2?page=N` returns res.ok === false (401/403 expired Clerk session, 429 rate limit, 5xx outage), producing `{ok:false, status}`.","commonSituations":"Stale/expired Suno cookies, IP rate limiting from frequent polling, Suno API outage, or navigating before the Clerk session token is available.","solutions":["Check the HTTP status in the message: 401/403 → re-login to Suno to refresh cookies; 429 → back off and retry later; 5xx → wait for Suno.","Run any read command after re-authenticating in the browser profile the CLI uses.","Retry with exponential backoff for transient 429/5xx.","Verify suno.com is reachable and not under an incident."],"exampleFix":"// before: hammering the feed in a loop\nfor (const p of pages) await opencli('suno', 'list', '--page', p);\n// after: backoff on failure\nawait withRetry(() => opencli('suno', 'list', '--page', p), { retries: 3, delayMs: 2000 });","handlingStrategy":"retry","validationCode":"// Refresh auth and confirm reachability before listing:\nawait ensureSunoSession(page); // throws early if cookies are dead\nif (sessionInvalid) await reloginSuno();","typeGuard":"function isFeedOk(r) { return !!r && r.ok === true && Array.isArray(r.clips); }","tryCatchPattern":"try {\n  const clips = await opencli('suno', 'list', '--limit', '20');\n} catch (e) {\n  const m = /HTTP (\\d+)/.exec(e.message);\n  const status = m && Number(m[1]);\n  if (status === 401 || status === 403) await reloginSuno();\n  else if (status === 429) await sleep(exponentialBackoff());\n  else if (!status) throw new Error('Suno unreachable — check network');\n  throw e;\n}","preventionTips":["Re-login to Suno whenever cookies may have expired before batch runs.","Back off on 429s; avoid tight polling loops on the feed endpoint.","Distinguish statuses: 401/403 → auth, 429 → rate limit, 5xx → outage.","Monitor suno.com status during incidents."],"tags":["http","auth","rate-limit"],"backgroundTag":"http-401-unauthorized","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}