jackwener/OpenCLI · error · AuthRequiredError
${probe.detail}
Error message
${probe.detail} What it means
CommandExecutionError raised when the bookmarkFoldersSlice GraphQL call returns an error payload. The context note 'account may not have folder access' reflects that bookmark folders are a gated Twitter feature (originally Blue/premium), so many accounts receive an authorization error even while logged in.
Source
Thrown at clis/12306/auth.js:40
if (/login\\.html/.test(r.url)) {
return { kind: 'auth', detail: '12306 initMy12306Api redirected to login' };
}
const t = await r.text();
let d = null;
try { d = JSON.parse(t); } catch {}
if (!d || d.status === false || /未登录|登录超时|NotLogin/i.test(t)) {
return { kind: 'auth', detail: '12306 initMy12306Api returned NotLogin' };
}
const userName = d.data?.user_name || d.data?.userName || d.user_name || '';
if (!userName) {
return { kind: 'auth', detail: '12306 initMy12306Api 200 but no user_name surface' };
}
return { ok: true, user_name: String(userName) };
} catch (e) {
return { kind: 'exception', detail: String(e && e.message || e) };
}
})()`);
if (probe?.kind === 'auth') throw new AuthRequiredError('12306.cn', probe.detail);
if (probe?.kind === 'exception') throw new CommandExecutionError(`12306 whoami failed: ${probe.detail}`);
if (!probe?.ok) throw new CommandExecutionError(`Unexpected 12306 probe: ${JSON.stringify(probe)}`);
return { user_name: probe.user_name };
}
registerSiteAuthCommands({
site: '12306',
domain: '12306.cn',
loginUrl: 'https://kyfw.12306.cn/otn/resources/login.html',
columns: ['user_name'],
quickCheck: has12306SessionCookie,
verify: verify12306Identity,
poll: async (page) => {
if (!await has12306SessionCookie(page)) {
throw new AuthRequiredError('12306.cn', 'Waiting for 12306 tk auth cookie');
}
return verify12306Identity(page);
},View on GitHub (pinned to 49907e53dc)
Solutions
- Confirm the account actually has bookmark-folder access (check x.com UI for folders under Bookmarks)
- Retry after a short pause to rule out transient 5xx/429
- Re-login to refresh the session and retry
- Update the CLI so resolveTwitterQueryId picks up the current GraphQL queryId
Defensive patterns
Strategy: fallback
Validate before calling
// Feature-gated: check account entitlement before calling // (no local preflight possible beyond a successful login); detect via catch.
Try / catch
try {
folders = await opencli('twitter bookmark-folders');
} catch (e) {
if (/bookmarkFoldersSlice/.test(e.message)) {
if (/403/.test(e.message)) folders = null; // account lacks folder access — degrade gracefully
else throw e;
}
} Prevention
- Confirm the account has the bookmark-folders feature in the x.com UI before scripting it
- Add backoff for transient 5xx/429
- Keep the CLI updated so resolveTwitterQueryId gets the current queryId
- Treat this as a permission/entitlement problem, not a bug, when the account is a free tier
When it happens
Trigger: The authenticated account is not entitled to bookmark folders; the endpoint returns 403/404 for the feature; a stale queryId produces 404; transient 5xx from Twitter; rate limiting.
Common situations: Free accounts trying to use a premium-only feature; region/rollout gating where the feature isn't enabled yet; running an older CLI whose pinned/fetched queryId no longer matches the deployed GraphQL API.
Related errors
- twitter_collection_request_error
- Twitter UserByScreenName returned GraphQL errors: ${JSON.str
- Failed to add @${username} to list ${listId}: ${msg.slice(0,
- HTTP ${result.httpStatus} from CreateList: ${snippet}
- CreateList failed: ${errors[0].message || JSON.stringify(err
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/385e965119a3ef2d.
Report an issue: GitHub.