{"record":{"id":"e85ec21950e93117","repo":"jackwener/OpenCLI","slug":"zhihu-answer-detail","errorCode":"zhihu answer-detail","errorMessage":"No Zhihu answer was found for ${answerId}.","messagePattern":"No Zhihu answer was found for (.+?)\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":404,"severity":"warning","filePath":"clis/zhihu/answer-detail.js","lineNumber":97,"sourceCode":"        try {\n          return await r.json();\n        } catch (error) {\n          return { __malformedJson: error instanceof Error ? error.message : String(error) };\n        }\n      })()\n    `).catch((err) => {\n            throw new CommandExecutionError(\n                `Zhihu answer detail request failed: ${err instanceof Error ? err.message : String(err)}`,\n                'Try again later or rerun with -v for more detail.',\n            );\n        });\n        if (!data || data.__httpError) {\n            const status = data?.__httpError;\n            if (status === 401 || status === 403) {\n                throw new AuthRequiredError('www.zhihu.com', 'Failed to fetch Zhihu answer detail');\n            }\n            if (status === 404) {\n                throw new EmptyResultError('zhihu answer-detail', `No Zhihu answer was found for ${answerId}.`);\n            }\n            throw new CommandExecutionError(\n                status\n                    ? `Zhihu answer detail request failed (HTTP ${status})`\n                    : 'Zhihu answer detail request failed',\n                'Try again later or rerun with -v for more detail',\n            );\n        }\n        if (data.__malformedJson) {\n            throw new CommandExecutionError(\n                `Zhihu answer detail returned malformed JSON: ${data.__malformedJson}`,\n                'Try again later or rerun with -v for more detail',\n            );\n        }\n        if (typeof data !== 'object' || Array.isArray(data)) {\n            throw new CommandExecutionError(\n                'Zhihu answer detail returned a malformed payload',\n                'Try again later or rerun with -v for more detail',","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/zhihu/answer-detail.js#L79-L115","documentation":"This EmptyResultError (code 'zhihu answer-detail') is thrown when the Zhihu answer detail API responds with HTTP 404, meaning no answer exists for the given answer id. It is a deliberate 'nothing found' signal rather than a failure, letting callers treat unknown ids as empty results.","triggerScenarios":"The in-page fetch returns __httpError === 404: the answerId passed on the command line does not correspond to any existing Zhihu answer (deleted answer, wrong id, or truncated/typo'd id).","commonSituations":"Answer was deleted by its author or removed by Zhihu moderation, id copied from an incomplete URL, digits transposed when typing the id, or scraping a very old answer that has since been purged.","solutions":["Double-check the answer id — open https://www.zhihu.com/answer/<id> in a browser to confirm it exists.","Copy the full answer URL and re-extract the id from /answer/<aid> instead of retyping it.","If the answer was deleted, no fix is possible; handle the empty result in your script."],"exampleFix":"// before\nclis zhihu answer-detail 19012345  // typo'd id -> 404\n// after\nclis zhihu answer-detail 6190123456789012345  // id verified against the live URL","handlingStrategy":"validation","validationCode":"// validate the id format before calling\nif (!/^\\d{10,20}$/.test(String(answerId))) throw new Error(`Suspicious answer id: ${answerId}`);","typeGuard":"function isEmptyResultError(err) { return err instanceof EmptyResultError || err?.code === 'zhihu answer-detail'; }","tryCatchPattern":"try {\n  const detail = await answerDetail(id);\n} catch (err) {\n  if (err instanceof EmptyResultError) {\n    console.warn(`Answer ${id} not found — skipping`);\n    return null;\n  }\n  throw err;\n}","preventionTips":["Extract answer ids programmatically from full URLs instead of retyping them.","Treat EmptyResultError as a skip condition in bulk scripts.","Check the answer still exists in a browser before deep workflows.","Record not-found ids to avoid repeatedly querying deleted content."],"tags":["http-404","empty-result","zhihu","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}