{"record":{"id":"0c24acc6237a8e12","repo":"jackwener/OpenCLI","slug":"zhihu-risk-control-blocked-answer-target-answeri","errorCode":null,"errorMessage":"Zhihu risk control blocked answer ${target.answerId} (40362): ${data.errorMessage || 'abnormal request'}","messagePattern":"Zhihu risk control blocked answer (.+?) \\(40362\\): (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/zhihu/download-helpers.js","lineNumber":209,"sourceCode":"          author: typeof payload.author?.name === 'string' ? payload.author.name : '',\n          createdTime: payload.created_time,\n          ...normalized\n        } };\n      })()\n    `).catch((error) => {\n        throw new CommandExecutionError(\n            `Zhihu answer download request failed: ${error instanceof Error ? error.message : String(error)}`,\n            'Try again later or rerun with -v for more detail.',\n        );\n    });\n\n    const data = unwrapEvaluateResult(raw);\n    if (!data || typeof data !== 'object' || Array.isArray(data)) {\n        throw new CommandExecutionError('Zhihu answer download returned a malformed Browser Bridge payload');\n    }\n    const status = data.status;\n    if (String(data.errorCode) === '40362') {\n        throw new CommandExecutionError(\n            `Zhihu risk control blocked answer ${target.answerId} (40362): ${data.errorMessage || 'abnormal request'}`,\n            'Open the answer in the connected Chrome profile and retry later.',\n        );\n    }\n    if (status === 401 || status === 403 || String(data.errorCode) === '40353' || data.needLogin) {\n        throw new AuthRequiredError('www.zhihu.com', 'Failed to download Zhihu answer');\n    }\n    if (status === 404) {\n        throw new EmptyResultError('zhihu download', `No Zhihu answer was found for ${target.answerId}.`);\n    }\n    if (status || data.fetchError) {\n        throw new CommandExecutionError(\n            status ? `Zhihu answer download request failed (HTTP ${status})` : 'Zhihu answer download request failed',\n            String(data.fetchError || data.errorMessage || 'Try again later or rerun with -v for more detail.'),\n        );\n    }\n    if (data.malformed || data.errorCode || data.errorMessage) {\n        throw new CommandExecutionError('Zhihu answer download returned a malformed or error payload');","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/zhihu/download-helpers.js#L191-L227","documentation":"Zhihu's anti-scraping risk control rejected the request to fetch an answer, returning errorCode 40362 ('abnormal request'). The Zhihu CLI's extractAnswer (via the Browser Bridge) detects this code and throws a CommandExecutionError instead of returning partial data. It signals Zhihu flagged the traffic or session as suspicious, not a bug in the CLI.","triggerScenarios":"Calling the Zhihu answer download flow (extractAnswer, invoked from the download/data command) when the in-page fetch returns { errorCode: '40362' } — i.e. Zhihu's server-side risk control rejected the request for that answerId.","commonSituations":"Scraping many answers in rapid succession from one account/IP; running headless or in a fresh Chrome profile with no browsing history or login; requesting answers during Zhihu risk-control sweeps; the answer being sensitive/removed and the fetch tripping anomaly detection.","solutions":["Open the target answer URL in the connected Chrome profile manually to prove the session is human, then retry the download later","Log into www.zhihu.com in the connected Chrome profile so requests carry authenticated cookies","Reduce request rate: add delays between answer downloads and lower batch size","Wait and retry — 40362 blocks are often temporary (minutes to hours)","If it persists, switch IP / network or use a different Chrome profile"],"exampleFix":"// before: immediate retry loop on failure\nawait downloadAnswer(id);\n// after: back off and verify session first\nif (err instanceof CommandExecutionError && err.message.includes('40362')) {\n  console.error('Open the answer in Chrome, log in, wait, then retry.');\n  await sleep(60_000);\n  await downloadAnswer(id);\n}","handlingStrategy":"retry","validationCode":"if (!target.answerId || typeof target.answerId !== 'string') throw new Error('Need a valid Zhihu answerId before download');\nconst answerUrl = `https://www.zhihu.com/question/x/answer/${target.answerId}`;\n// verify the URL loads in the connected Chrome profile before batch-downloading","typeGuard":"function isRiskControlBlock(err) {\n  return err instanceof Error && err.message.includes('40362');\n}","tryCatchPattern":"try {\n  const answer = await downloadAnswer(target);\n} catch (err) {\n  if (isRiskControlBlock(err)) {\n    console.error('Blocked by Zhihu risk control. Open the answer in Chrome, log in, wait, then retry.');\n    await sleep(60_000);\n    return downloadAnswer(target); // bounded retries only\n  }\n  throw err;\n}","preventionTips":["Log in to www.zhihu.com in the connected Chrome profile before bulk downloads","Throttle answer downloads with delays between requests","Keep a warm, regularly used Chrome profile rather than a fresh/headless one","Spot-check the answer URL manually when a 40362 first appears before retrying"],"tags":["zhihu","risk-control","anti-bot","http-40362","scraping"],"backgroundTag":"anti-bot-risk-control-block","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}