jackwener/OpenCLI · error · AuthRequiredError
${probe.detail}
Error message
${probe.detail} What it means
verifyBandIdentity() throws AuthRequiredError when the in-page probe reports kind='auth', propagating probe.detail as the message — meaning after navigating to band.us/feed the page redirected to a login/auth flow (e.g. location.href matched auth.band.us/login).
Source
Thrown at clis/band/auth.js:44
if (!node || typeof node !== 'object' || seen.has(node)) continue;
seen.add(node);
if (Array.isArray(node)) { stack.push(...node); continue; }
const u = node.user || node.me || node.currentUser;
if (u && (u.user_no || u.user_id || u.userId || u.id)) {
userId = String(u.user_no || u.user_id || u.userId || u.id);
break;
}
for (const v of Object.values(node)) if (v && typeof v === 'object') stack.push(v);
}
} catch {}
if (!userId) {
const el = document.querySelector('[data-user-no], [data-user_no]');
userId = el?.getAttribute('data-user-no') || el?.getAttribute('data-user_no') || '';
}
return { ok: true, user_id: userId };
})()
`);
if (probe?.kind === 'auth') throw new AuthRequiredError('band.us', probe.detail);
if (!probe?.ok) throw new CommandExecutionError(`Unexpected Band probe: ${JSON.stringify(probe)}`);
return { user_id: probe.user_id };
}
registerSiteAuthCommands({
site: 'band',
domain: 'band.us',
loginUrl: 'https://auth.band.us/login',
columns: ['user_id'],
quickCheck: hasBandSessionCookie,
verify: verifyBandIdentity,
poll: async (page) => {
if (!await hasBandSessionCookie(page)) {
throw new AuthRequiredError('band.us', 'Waiting for Band band_session cookie');
}
return verifyBandIdentity(page);
},
});View on GitHub (pinned to 49907e53dc)
Solutions
- Re-run the band login/auth flow to refresh the session
- Clear band.us cookies and log in fresh if a stale cookie keeps causing redirects
- Read probe.detail (in the error message) for the specific auth failure reason
Example fix
// before bandWhoami() // stale cookie -> redirect to auth.band.us/login // after await bandLogoutAndClearCookies(); await bandLogin(); await bandWhoami();
Defensive patterns
Strategy: fallback
Validate before calling
const resp = await fetch('https://www.band.us/feed', { redirect: 'manual' });
if (String(resp.status).startsWith('3') && String(resp.headers.get('location') || '').includes('auth.band.us')) {
await runBandLogin();
} Try / catch
try {
await bandCommand(args);
} catch (err) {
if (err instanceof AuthRequiredError && /auth\.band\.us|login/i.test(err.message)) {
await clearBandCookies();
await runBandLogin();
return bandCommand(args);
}
throw err;
} Prevention
- Refresh the session periodically instead of letting cookies go stale
- Detect redirects to auth.band.us in your own flow and re-login proactively
- Clear stale band.us cookies before logging in again
When it happens
Trigger: band_session cookie exists but is stale/invalid so band.us redirects to auth.band.us/login; partial session where some cookies were cleared; SSO flow requiring re-consent.
Common situations: Expired session cookie that still exists; logging out in another tab; Band changing its auth redirect behavior.
Related errors
- `Facebook /me redirected to ${finalUrl} — logged out or in c
- Band band_session cookie missing
- Browser session required for bilibili follow
- Browser session required for bilibili following
- Boss wt2 / t cookies missing
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/eb65e2e4a5651f14.
Report an issue: GitHub.