jackwener/OpenCLI · error · CommandExecutionError
Zhihu user request failed (HTTP ${status})
Error message
Zhihu user request failed (HTTP ${status}) What it means
When the in-page fetch returns an HTTP status other than 401/403/404 (or no recognizable data), the user command throws CommandExecutionError 'Zhihu user request failed (HTTP <status>)'. It is the generic transport/HTTP failure branch for the Zhihu profile fetch.
Source
Thrown at clis/zhihu/user.js:42
(async () => {
try {
const r = await fetch(${JSON.stringify(apiUrl)}, { credentials: 'include' });
if (!r.ok) return { __httpError: r.status };
return await r.json();
} catch (err) {
return { __fetchError: err?.message || String(err) };
}
})()
`));
if (!data || typeof data !== 'object' || Array.isArray(data) || data.__httpError || data.__fetchError) {
const status = data?.__httpError;
if (status === 401 || status === 403) {
throw new AuthRequiredError('www.zhihu.com', 'Failed to fetch Zhihu user profile');
}
if (status === 404) {
throw new EmptyResultError('zhihu user', `No Zhihu user was found for ${slug}.`);
}
throw new CommandExecutionError(status ? `Zhihu user request failed (HTTP ${status})` : 'Zhihu user request failed', data?.__fetchError ? String(data.__fetchError) : 'Try again later or rerun with -v');
}
if (!data.url_token || !data.id || !data.name) {
throw new CommandExecutionError('Zhihu user response missing identity fields', 'Zhihu may have changed its API shape');
}
return [{
url_token: String(data.url_token || ''),
name: String(data.name || ''),
headline: String(data.headline || ''),
followers: data.follower_count ?? 0,
following: data.following_count ?? 0,
answers: data.answer_count ?? 0,
articles: data.articles_count ?? 0,
voteup: data.voteup_count ?? 0,
url: data.url_token ? `https://www.zhihu.com/people/${data.url_token}` : '',
}];
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Retry after a delay (especially for 429/5xx)
- Reduce request frequency / add backoff between calls
- Rerun with -v to see the underlying cause recorded as the secondary message
- Re-login if the session state is suspect (unclassified statuses can mask auth issues)
Defensive patterns
Strategy: retry
Try / catch
async function fetchUserWithRetry(slug, attempts = 3) {
for (let i = 0; i < attempts; i++) {
try { return await fetchZhihuUser(slug); }
catch (e) {
if (/HTTP (429|5\d\d)/.test(e.message) && i < attempts - 1) {
await sleep(1000 * 2 ** i); continue;
}
throw e;
}
}
} Prevention
- Add exponential backoff and honor 429s
- Throttle request rate across jobs hitting www.zhihu.com
- Run with -v to capture the secondary error detail for triage
- Alert on repeated 5xx so Zhihu incidents are noticed
When it happens
Trigger: Any non-401/403/404 status from www.zhihu.com during the profile fetch: 429 rate-limiting, 5xx server errors, redirects to verification pages, or data=null with no __httpError/__fetchError classification.
Common situations: Aggressive polling of the Zhihu API leading to 429; Zhihu incidents returning 5xx; anti-bot challenges returning unusual statuses; network proxies mangling requests.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- Zhihu collection request failed (HTTP ${status})
- ${errorLabel} from Zhihu failed (HTTP ${status})
- 12306 queryByTrainNo returned HTTP ${resp.status}
- 12306 queryByTrainNo returned non-JSON body
- 12306 ${endpoint} returned non-JSON body
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/60e89e6ec61696af.
Report an issue: GitHub.