jackwener/OpenCLI · error · CommandExecutionError
用户信息获取失败,请确认已登录 creator.douyin.com
Error message
用户信息获取失败,请确认已登录 creator.douyin.com
What it means
Thrown by the douyin profile command when the user info endpoint returns no recognizable user object (neither res.user_info nor res.user). Almost always means the browser session is not authenticated to creator.douyin.com.
Source
Thrown at clis/douyin/profile.js:18
import { cli, Strategy } from '@jackwener/opencli/registry';
import { browserFetch } from './_shared/browser-fetch.js';
import { CommandExecutionError } from '@jackwener/opencli/errors';
cli({
site: 'douyin',
name: 'profile',
access: 'read',
description: '获取账号信息',
domain: 'creator.douyin.com',
strategy: Strategy.COOKIE,
args: [],
columns: ['uid', 'nickname', 'follower_count', 'following_count', 'aweme_count'],
func: async (page, _kwargs) => {
const url = 'https://creator.douyin.com/web/api/media/user/info/?aid=1128';
const res = (await browserFetch(page, 'GET', url));
const u = res.user_info ?? res.user;
if (!u)
throw new CommandExecutionError('用户信息获取失败,请确认已登录 creator.douyin.com');
return [
{
uid: u.uid,
nickname: u.nickname,
follower_count: u.follower_count,
following_count: u.following_count,
aweme_count: u.aweme_count,
},
];
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Log in to creator.douyin.com in the managed browser profile and re-run.
- Refresh/restore session cookies for creator.douyin.com.
- Verify manually: open the same user/info URL in the browser — it should return JSON with your uid.
- Check whether Douyin risk control invalidated the session (re-login required) and update the library if login flow changed.
Example fix
// before: reusing a stale browser profile opencli douyin profile // after: re-authenticate first opencli douyin login # or re-open the managed browser and log in opencli douyin profile
Defensive patterns
Strategy: validation
Validate before calling
// probe login before reading profile
const probe = await fetch('https://creator.douyin.com/web/api/media/user/info/?aid=1128');
const body = await probe.json();
if (!(body.user_info ?? body.user)) throw new Error('douyin session invalid; log in to creator.douyin.com first'); Type guard
function hasDouyinUser(res) {
return res != null && typeof res === 'object' && Boolean(res.user_info ?? res.user);
} Try / catch
try {
const profile = await douyinProfile();
} catch (e) {
if (String(e.message).includes('请确认已登录')) {
await openDouyinLogin();
return douyinProfile();
}
throw e;
} Prevention
- Re-login to creator.douyin.com whenever sessions age out (cookies typically expire in days).
- Probe the user/info endpoint as a health check in scheduled jobs.
- Keep the browser profile persistent so cookies survive restarts.
- Watch for douyin risk-control logouts after long idle periods.
When it happens
Trigger: GET https://creator.douyin.com/web/api/media/user/info/ returns a payload without user_info/user — typically because cookies are missing/expired — causing `if (!u)` at clis/douyin/profile.js:18 to throw.
Common situations: Session cookie expired; profile was never logged in; Douyin invalidated the session (password change, risk control); running headless with a stale profile.
Related errors
- Douyin API auth/permission error ${code} at ${method} ${url}
- 获取抖音上传授权失败: ${message}
- 请先在共享 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/b8bc4d6b56c17643.
Report an issue: GitHub.