jackwener/OpenCLI · error · CommandExecutionError

Unexpected Suno probe: ${JSON.stringify(probe)}

Error message

Unexpected Suno probe: ${JSON.stringify(probe)}

What it means

After all known probe outcomes (auth/http/exception) are handled, a probe result that is neither ok nor one of those kinds means the in-page script returned something unexpected (undefined, shape drift after a Clerk/Suno API change). verifySunoIdentity throws a CommandExecutionError embedding the JSON of the probe for diagnosis.

Source

Thrown at clis/suno/auth.js:46

      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. Inspect the JSON in the message — it shows the actual probe shape
  2. Check if Clerk's /v1/client response schema changed and update the probe in clis/suno/auth.js
  3. Re-run after ensuring the browser page stays open for the duration of the command
  4. Pin/update _clerk_js_version to match Suno's current Clerk build

Example fix

// before
if (!probe?.ok) throw new CommandExecutionError(`Unexpected Suno probe: ${JSON.stringify(probe)}`);
// after — tolerate missing sessions field shape drift
const sessions = d?.response?.sessions ?? d?.sessions ?? [];
if (!sessions.length) return { kind: 'auth', detail: 'clerk.suno.com sessions=[] — anonymous' };
Defensive patterns

Strategy: type-guard

Validate before calling

// Detect an unusable probe result before depending on it
if (!probe || typeof probe !== 'object' || (!('ok' in probe) && !('kind' in probe))) {
  throw new Error('Clerk probe returned no recognizable shape: ' + JSON.stringify(probe));
}

Type guard

function isProbeResult(p) {
  return p != null && typeof p === 'object' &&
    (p.ok === true || ['auth','http','exception'].includes(p.kind));
}

Try / catch

try {
  await cli('suno', 'whoami');
} catch (e) {
  if (/Unexpected Suno probe/.test(e.message)) {
    console.error('Clerk API shape may have changed:', e.message); // report, don't auto-retry
  }
  throw e;
}

Prevention

When it happens

Trigger: page.evaluate returns null/undefined (serialization failure, page torn down) or Clerk's /v1/client response shape changed so the probe returns an unrecognized object without `kind`.

Common situations: Clerk API version bump (the probe pins _clerk_js_version=5) changing response fields; evaluate result lost because the browser page closed; middleware returning an unexpected redirect body.

Related errors


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