jackwener/OpenCLI · error · AuthRequiredError
Douyin API auth/permission error ${code} at ${method} ${url}
Error message
Douyin API auth/permission error ${code} at ${method} ${url}: ${msg} What it means
When the Douyin API responds with a non-zero status_code that looks like an auth/permission problem (per isAuthLikeError), browserFetch throws AuthRequiredError for creator.douyin.com. This signals the session's credentials are missing, expired, or lack permission for the endpoint.
Source
Thrown at clis/douyin/_shared/browser-fetch.js:67
}
catch (error) {
throw new CommandExecutionError(`Douyin API request failed (${method} ${url}): ${error instanceof Error ? error.message : String(error)}`);
}
if (result == null) {
throw new CommandExecutionError(
`Empty response from Douyin API (${method} ${url})`,
'The endpoint may have been retired or may now require signed parameters.',
);
}
if (Array.isArray(result) || typeof result !== 'object') {
throw new CommandExecutionError(`Malformed response from Douyin API (${method} ${url})`);
}
if (result && typeof result === 'object' && 'status_code' in result) {
const code = result.status_code;
if (code !== 0) {
const msg = result.status_msg ?? result.message ?? 'unknown error';
if (isAuthLikeError(code, msg)) {
throw new AuthRequiredError('creator.douyin.com', `Douyin API auth/permission error ${code} at ${method} ${url}: ${msg}`);
}
throw new CommandExecutionError(`Douyin API error ${code} at ${method} ${url}: ${msg}`);
}
}
return result;
}
View on GitHub (pinned to 49907e53dc)
Solutions
- Re-login to creator.douyin.com in the browser used by the tool and refresh the session/cookies.
- Confirm the logged-in account has creator publishing permissions.
- Retry after completing any captcha/risk-control challenge Douyin presented.
- If persistent, clear stale cookie state and rebuild the authenticated session from scratch.
Example fix
// before: retrying endlessly on auth error
while (true) { await browserFetch(page, api); }
// after: catch AuthRequiredError and force re-login
import { AuthRequiredError } from './_shared/errors.js';
try {
const data = await browserFetch(page, api);
} catch (e) {
if (e instanceof AuthRequiredError) {
await reloginCreatorDouyin();
return browserFetch(page, api);
}
throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
null
Type guard
null
Try / catch
import { AuthRequiredError } from './_shared/errors.js';
try {
const data = await browserFetch(page, api);
} catch (e) {
if (e instanceof AuthRequiredError) {
await relogin('creator.douyin.com');
return browserFetch(page, api); // single retry after re-auth
}
throw e;
} Prevention
- Refresh creator.douyin.com cookies before long batch jobs
- Check session validity with a lightweight authenticated endpoint first
- Ensure the account has creator permissions for the APIs used
- Handle captcha/risk-control prompts promptly to avoid session revocation
When it happens
Trigger: result.status_code !== 0 and isAuthLikeError(code, msg) is true — e.g. status codes/messages indicating not-logged-in, session expired, or insufficient permissions on creator.douyin.com APIs.
Common situations: Browser cookies expired overnight; running the CLI on a machine whose stored session was revoked; using an account without creator permissions; Douyin invalidating sessions after risk-control checks.
Related errors
- 获取抖音上传授权失败: ${message}
- 用户信息获取失败,请确认已登录 creator.douyin.com
- 请先在共享 Chrome 完成 1688 登录/验证,再重试(${action})
- Bilibili ${label} API requires login or permission: ${messag
- bilibili.com
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/4dbb15420d7a9603.
Report an issue: GitHub.