jackwener/OpenCLI · error · AuthRequiredError

Suno feed API rejected (HTTP ${result.status}). Re-login.

Error message

Suno feed API rejected (HTTP ${result.status}). Re-login.

What it means

pollSunoClips polls Suno's cookie-authenticated /api/feed/v3 endpoint. A 401 or 403 response means the browser's Suno session cookies are expired or invalid, so AuthRequiredError is thrown instructing the user to re-login on suno.com.

Source

Thrown at clis/suno/utils.js:375

    const idsJson = JSON.stringify(clipIds);

    while (Date.now() < deadline) {
        const result = unwrapEvaluateResult(await page.evaluate(`(async () => {
            const res = await fetch('${STUDIO_API}/api/feed/v3', {
                method: 'POST',
                headers: ${sunoHeadersJs(deviceId, { 'Content-Type': 'application/json' })},
                body: JSON.stringify({ clip_ids: ${idsJson} }),
            });
            const body = await res.json().catch(() => null);
            return { status: res.status, body };
        })()`));

        if (!result) {
            await page.wait(pollSeconds);
            continue;
        }
        if (result.status === 401 || result.status === 403) {
            throw new AuthRequiredError(SUNO_DOMAIN, `Suno feed API rejected (HTTP ${result.status}). Re-login.`);
        }
        if (result.status < 200 || result.status >= 300) {
            throw new CommandExecutionError(`Suno feed API failed while polling clips (HTTP ${result.status || '?'})`);
        }
        if (!result.body || typeof result.body !== 'object' || Array.isArray(result.body)) {
            throw new CommandExecutionError('Suno feed API returned malformed JSON while polling clips');
        }

        const allClips = result.body.clips || [];
        if (!Array.isArray(allClips)) {
            throw new CommandExecutionError('Suno feed API returned malformed clips payload');
        }
        const ourClips = allClips.filter(c => targetSet.has(c.id));
        const finished = ourClips.filter(c => c.status === 'complete' || c.status === 'error');

        if (typeof onProgress === 'function') {
            onProgress({ total: clipIds.length, done: finished.length, statuses: ourClips.map(c => `${c.id.slice(0,8)}:${c.status}`) });
        }

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-authenticate: run the suno login/auth command to refresh cookies in the browser session.
  2. Restart the poll command immediately after re-login.
  3. Increase cookie persistence (keep the profile/session between runs) to avoid mid-run expiry.
  4. If it recurs quickly, check suno.com for concurrent-session or security events.

Example fix

// before: polling with a stale session until it 401s
const clips = await pollSunoClips(page, ids, 300, deviceId);
// after: verify session first and re-auth on AuthRequiredError
try {
  await verifySunoSession(page);
  const clips = await pollSunoClips(page, ids, 300, deviceId);
} catch (e) {
  if (e instanceof AuthRequiredError) { await sunoLogin(page); return pollSunoClips(page, ids, 300, deviceId); }
  throw e;
}
Defensive patterns

Strategy: retry

Validate before calling

// pre-flight session check before polling
const res = await fetch(STUDIO_API + '/api/feed/v3', { method: 'POST', headers });
if (res.status === 401 || res.status === 403) throw new AuthRequiredError(SUNO_DOMAIN, 'Session invalid — re-login first');

Try / catch

try {
  const clips = await pollSunoClips(page, ids, timeout, deviceId);
} catch (e) {
  if (e instanceof AuthRequiredError) {
    await sunoLogin(page);
    return pollSunoClips(page, ids, timeout, deviceId);
  }
  throw e;
}

Prevention

When it happens

Trigger: During clip polling, the feed endpoint returns HTTP 401 or 403 — the session cookie expired mid-run, cookies were cleared, or the Suno session was invalidated server-side (e.g. logged in elsewhere).

Common situations: Long generation runs outlasting cookie TTL; user logged out or into another session on suno.com; cookie jar not persisted between CLI runs; IP/region change triggering session invalidation.

Related errors


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