{"record":{"id":"13f9acd2afa04df7","repo":"jackwener/OpenCLI","slug":"no-item-detail-was-returned-for-the-specified-item","errorCode":null,"errorMessage":"No item detail was returned for the specified item_id","messagePattern":"No item detail was returned for the specified item_id","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/xianyu/item.js","lineNumber":145,"sourceCode":"        if (result?.error === 'blocked') {\n            throw new EmptyResultError('xianyu item', 'Xianyu item detail is blocked by verification or risk control');\n        }\n        if (result?.error === 'mtop-not-ready') {\n            throw selectorError('window.lib.mtop', '闲鱼页面未完成初始化，无法调用商品详情接口');\n        }\n        if (!result || typeof result !== 'object') {\n            throw new EmptyResultError('xianyu item', '闲鱼商品详情接口未返回有效数据');\n        }\n        const errorCode = String(result.error_code || '');\n        const errorMessage = String(result.error_message || '');\n        if (/FAIL_SYS_SESSION_EXPIRED|SESSION_EXPIRED|FAIL_SYS/.test(errorCode) || /FAIL_SYS_SESSION_EXPIRED|SESSION_EXPIRED/.test(errorMessage)) {\n            throw new AuthRequiredError('www.goofish.com', 'Xianyu item detail requires a logged-in browser session');\n        }\n        if (result.error) {\n            throw new EmptyResultError('xianyu item', errorMessage || `Xianyu item detail request failed: ${result.error}`);\n        }\n        if (!String(result.title || '').trim()) {\n            throw new EmptyResultError('xianyu item', 'No item detail was returned for the specified item_id');\n        }\n        return [result];\n    },\n});\nexport const __test__ = {\n    normalizeNumericId,\n    buildItemUrl,\n};\n","sourceCodeStart":127,"sourceCodeEnd":154,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xianyu/item.js#L127-L154","documentation":"After the xianyu item detail fetch succeeds without an `error` field, the code verifies the response actually contains a non-empty `title`. If the returned object has no title, the library concludes no real item detail came back and throws EmptyResultError('xianyu item', 'No item detail was returned for the specified item_id'). This guards against empty-shell responses that technically parsed but carry no item data.","triggerScenarios":"Requesting an item_id for a listing that was deleted, is unlisted/private, is region-locked, or for which the API returns an empty/blank detail object (title missing or whitespace-only).","commonSituations":"Processing old item_ids from a database where listings have since been removed; scraping items outside the logged-in account's visible region; item IDs mistyped so a different (empty) entity is returned; bot-detection serving empty payloads instead of an explicit error.","solutions":["Confirm the item_id is correct and the listing still exists by opening https://www.goofish.com/item?id=<item_id> in a browser.","Remove the item_id from your processing queue if the listing is deleted — this is a permanent empty result.","Log in to www.goofish.com in the automation browser session; some listings are only returned to authenticated sessions.","Retry later if you suspect soft bot-blocking (empty payload instead of an error code).","Batch-validate item_ids first (skip ones that fail) rather than letting the whole run abort."],"exampleFix":"// before: one dead item aborts the batch\nfor (const id of ids) await itemDetail(id);\n\n// after: treat empty result as 'listing gone' and continue\nfor (const id of ids) {\n  try { await itemDetail(id); }\n  catch (e) { if (e instanceof EmptyResultError) { missing.push(id); continue; } throw e; }\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function hasItemPayload(r) { return r != null && typeof r.title === 'string' && r.title.trim().length > 0; }","tryCatchPattern":"try {\n  await itemDetail(id);\n} catch (e) {\n  if (e instanceof EmptyResultError && /No item detail/.test(e.message)) {\n    markListingGone(id); return null; // treat as deleted listing\n  }\n  throw e;\n}","preventionTips":["Prune item_ids of known-deleted listings before batch runs.","Verify listings in a browser when an id repeatedly returns empty.","Run authenticated sessions — some listings need login.","Treat repeated empty payloads for the same id as permanent and skip."],"tags":["xianyu","empty-result","missing-data","scraping"],"backgroundTag":"empty-response-payload","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}