jackwener/OpenCLI · error · AuthRequiredError
Band band_session cookie missing
Error message
Band band_session cookie missing
What it means
verifyBandIdentity() throws AuthRequiredError when the browser session has no non-empty band_session cookie for band.us. The library cannot confirm a logged-in Band identity without this session cookie.
Source
Thrown at clis/band/auth.js:11
import { AuthRequiredError, CommandExecutionError } from '@jackwener/opencli/errors';
import { registerSiteAuthCommands } from '../_shared/site-auth.js';
async function hasBandSessionCookie(page) {
const cookies = await page.getCookies({ url: 'https://www.band.us' });
return cookies.some(c => c.name === 'band_session' && c.value);
}
async function verifyBandIdentity(page) {
if (!await hasBandSessionCookie(page)) {
throw new AuthRequiredError('band.us', 'Band band_session cookie missing');
}
await page.goto('https://www.band.us/feed');
await page.wait(2);
const probe = await page.evaluate(`
(() => {
if (/auth\\.band\\.us\\/login/.test(location.href)) {
return { kind: 'auth', detail: 'Band /feed redirected to auth login' };
}
let userId = '';
try {
const stack = [window.__INITIAL_STATE__, window.__BAND_STORE__].filter(Boolean);
const seen = new Set();
while (stack.length) {
const node = stack.pop();
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;View on GitHub (pinned to 49907e53dc)
Solutions
- Run the band login/auth command to establish a session (get the band_session cookie)
- Verify cookies for https://www.band.us exist in the browser profile used by the tool
- Re-login if you recently changed your password or Band invalidated sessions
Example fix
// before bandList() // no session // after await bandLogin(); // establishes band_session cookie await bandList();
Defensive patterns
Strategy: try-catch
Validate before calling
const cookies = await page.getCookies({ url: 'https://www.band.us' });
const hasSession = cookies.some(c => c.name === 'band_session' && c.value);
if (!hasSession) await runBandLogin(); Type guard
function hasBandSessionCookie(cookies) {
return Array.isArray(cookies) && cookies.some(c => c.name === 'band_session' && Boolean(c.value));
} Try / catch
try {
await bandCommand(args);
} catch (err) {
if (err instanceof AuthRequiredError || /band_session cookie missing/.test(err.message)) {
await runBandLogin();
return bandCommand(args); // retry once after login
}
throw err;
} Prevention
- Run the site auth/login flow before band commands
- Persist the browser profile so cookies survive restarts
- Proactively check for the band_session cookie at startup
When it happens
Trigger: Running a band command before ever logging in via the site auth flow; the stored browser profile was cleared; Band rotated/invalidated the cookie after a server-side logout.
Common situations: Fresh environment/container without a persisted browser profile; password changed elsewhere logging sessions out; cookie expiry after long inactivity.
Related errors
- ${probe.detail}
- Bilibili creator-center login is required: ${message}
- 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/745d283702666f9c.
Report an issue: GitHub.