jackwener/OpenCLI · error · CommandExecutionError
Xiaohongshu creator profile returned malformed personal_info
Error message
Xiaohongshu creator profile returned malformed personal_info payload
What it means
verifyXhsIdentity throws this CommandExecutionError when the personal_info API call succeeded (ok true) but parsed.data is missing — the response body isn't the expected {data:{name,fans_count,...}} shape. This is treated as a malformed payload rather than an auth problem, since the server responded.
Source
Thrown at clis/xiaohongshu/auth.js:32
try {
const resp = await fetch('/api/galaxy/creator/home/personal_info', { credentials: 'include' });
const text = await resp.text();
let parsed = null;
try { parsed = JSON.parse(text); } catch {}
return [resp.ok, resp.status, parsed, text.slice(0, 200)];
} catch (error) {
return [false, 0, null, String(error && error.message || error)];
}
}
`);
const [ok, status, parsed, preview] = Array.isArray(payload) ? payload : [];
if (!ok) {
const detail = parsed?.msg ?? preview ?? `HTTP ${status ?? ''}`;
throw new AuthRequiredError('creator.xiaohongshu.com', `Xiaohongshu creator profile requires login: ${detail}`);
}
const data = parsed?.data;
if (!data) {
throw new CommandExecutionError('Xiaohongshu creator profile returned malformed personal_info payload');
}
return {
username: data.name ?? '',
followers: data.fans_count ?? 0,
};
}
registerSiteAuthCommands({
site: 'xiaohongshu',
domain: 'creator.xiaohongshu.com',
loginUrl: 'https://creator.xiaohongshu.com/',
columns: ['username', 'followers'],
quickCheck: hasXhsSessionCookies,
verify: verifyXhsIdentity,
poll: async (page) => {
if (!await hasXhsSessionCookies(page)) {
throw new AuthRequiredError('creator.xiaohongshu.com', 'Waiting for Xiaohongshu session cookies');
}View on GitHub (pinned to 49907e53dc)
Solutions
- Update the library to match the current personal_info response schema.
- Log parsed/preview to inspect the actual response body shape.
- Confirm the account actually has a creator profile on creator.xiaohongshu.com.
- Retry — transient server issues may return empty data.
- Re-login in case a half-valid session yields a degraded response.
Example fix
// before
const { username, followers } = await verifyXhsIdentity(page);
// after
let identity;
try {
identity = await verifyXhsIdentity(page);
} catch (e) {
if (String(e.message).includes('malformed personal_info')) {
identity = { username: '', followers: 0 }; // tolerate missing creator data
} else throw e;
} Defensive patterns
Strategy: validation
Validate before calling
// validate response shape yourself if you control the fetch layer
function hasCreatorData(parsed) {
return parsed && typeof parsed === 'object' &&
parsed.data && typeof parsed.data === 'object';
} Type guard
function hasCreatorData(p) {
return !!p && typeof p === 'object' &&
!!p.data && typeof p.data === 'object' &&
typeof p.data.name === 'string';
} Try / catch
try {
return await verifyXhsIdentity(page);
} catch (e) {
if (/malformed personal_info/.test(e.message)) {
return { username: '', followers: 0 }; // degrade gracefully
}
throw e;
} Prevention
- Pin/update library versions when the creator API schema changes.
- Confirm the account has creator data before relying on identity checks.
- Log raw response bodies on this error to detect schema drift early.
- Handle empty/degraded responses server-side instead of crashing.
When it happens
Trigger: parsed?.data is undefined after a successful request: XHS returned ok/ success wrapper without data, or the response shape changed (e.g. data nested differently, or an HTML error page parsed oddly).
Common situations: creator.xiaohongshu.com API version changed its response envelope; the account exists but has no creator profile data; server-side degradation returning empty data; a proxy/CDN injected an unexpected body.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Cannot resolve aid for bvid: ${bvid}
- Bilibili reply add API did not return rpid for the posted co
- pubmed article ${pmid} did not include a title
- pubmed author did not return an id list
- pubmed clinical-trial did not return an id list
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/686e0a85a674d68d.
Report an issue: GitHub.