jackwener/OpenCLI · error · CommandExecutionError

Suno whoami failed: ${probe.detail}

Error message

Suno whoami failed: ${probe.detail}

What it means

The in-page fetch to clerk.suno.com/v1/client threw a JS exception (network error, Clerk SDK/global problem, CORS, etc.); the probe caught it and verifySunoIdentity surfaces it as `Suno whoami failed: <detail>`. The library deliberately converts page-side exceptions into a CommandExecutionError carrying the original message.

Source

Thrown at clis/suno/auth.js:45

      if (!r.ok) return { kind: 'http', httpStatus: r.status };
      const d = await r.json();
      const sessions = d?.response?.sessions || [];
      if (!Array.isArray(sessions) || sessions.length === 0) {
        return { kind: 'auth', detail: 'clerk.suno.com sessions=[] — anonymous' };
      }
      const active = sessions.find(s => s.status === 'active') || sessions[0];
      const user = active?.user;
      if (!user?.id) {
        return { kind: 'auth', detail: 'clerk.suno.com session present but no user.id — stale session' };
      }
      return { ok: true, user_id: String(user.id), name: String(user.username || '') };
    } catch (e) {
      return { kind: 'exception', detail: String(e && e.message || e) };
    }
  })()`);
  if (probe?.kind === 'auth') throw new AuthRequiredError('suno.com', probe.detail);
  if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from clerk.suno.com`);
  if (probe?.kind === 'exception') throw new CommandExecutionError(`Suno whoami failed: ${probe.detail}`);
  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Suno probe: ${JSON.stringify(probe)}`);
  return { user_id: probe.user_id, name: probe.name };
}

registerSiteAuthCommands({
  site: 'suno',
  domain: 'suno.com',
  loginUrl: 'https://suno.com/?sign-in=true',
  columns: ['user_id', 'name'],
  quickCheck: hasSunoClerkCookie,
  verify: verifySunoIdentity,
  poll: async (page) => {
    if (!await hasSunoClerkCookie(page)) {
      throw new AuthRequiredError('suno.com', 'Waiting for Suno Clerk __session/__client cookie');
    }
    return verifySunoIdentity(page);
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Read the `detail` suffix in the message — it contains the underlying exception
  2. Retry the command; transient network errors resolve themselves
  3. Re-open the suno login/session so the page context is healthy and window.Clerk is initialized
  4. Check browser settings/extensions that block clerk.suno.com requests

Example fix

// before
Suno whoami failed: Failed to fetch
// after — ensure page is on suno.com and Clerk is ready before probing
await page.goto('https://suno.com/');
await page.waitForFunction(() => !!window.Clerk);
await verifySunoIdentity(page);
Defensive patterns

Strategy: retry

Validate before calling

// Ensure the page is on suno.com and Clerk is initialized before any suno command
await page.goto('https://suno.com/');
await page.waitForFunction(() => !!window.Clerk);

Type guard

function looksLikeNetworkFailure(detail) {
  return /Failed to fetch|NetworkError|aborted/i.test(String(detail));
}

Try / catch

try {
  await cli('suno', 'whoami');
} catch (e) {
  if (/Suno whoami failed:/.test(e.message) && looksLikeNetworkFailure(e.message)) {
    await sleep(2000); return cli('suno', 'whoami'); // transient network error
  }
  throw e;
}

Prevention

When it happens

Trigger: window fetch throws inside page.evaluate during verifySunoIdentity — e.g. `window.Clerk` missing so a later probe step fails, network fetch aborted, TLS error, or page navigated/closed mid-probe.

Common situations: Flaky connectivity mid-probe; automation page closed or navigated by another tab; browser blocking third-party requests to clerk.suno.com; extensions or privacy settings killing the request.

Related errors


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