{"record":{"id":"30721ba43303e2dd","repo":"jackwener/OpenCLI","slug":"error-30721b","errorCode":null,"errorMessage":"没有匹配的商品（筛选条件可能过窄，或当前关键词无结果）","messagePattern":"没有匹配的商品（筛选条件可能过窄，或当前关键词无结果）","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/xianyu/search.js","lineNumber":249,"sourceCode":"            throw selectorError('window.lib.mtop', '闲鱼页面未完成初始化，无法调用搜索接口');\n        }\n        if (!result || typeof result !== 'object') {\n            throw new CommandExecutionError('Xianyu search returned a malformed response');\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_TOKEN/.test(errorCode) || /FAIL_SYS_SESSION_EXPIRED|SESSION_EXPIRED/.test(errorMessage)) {\n            throw new AuthRequiredError('www.goofish.com', 'Xianyu search requires a logged-in browser session');\n        }\n        if (result?.error) {\n            throw new CommandExecutionError(errorMessage || `Xianyu search request failed: ${result.error}`);\n        }\n        if (!Array.isArray(result.items)) {\n            throw new CommandExecutionError('Xianyu search response did not include an items array');\n        }\n        const items = result.items;\n        if (!items.length) {\n            throw new EmptyResultError('xianyu search', '没有匹配的商品（筛选条件可能过窄，或当前关键词无结果）');\n        }\n        return items.map((item, index) => ({ rank: index + 1, ...item }));\n    },\n});\nexport const __test__ = {\n    ROWS_PER_PAGE,\n    MAX_LIMIT,\n    normalizeLimit,\n    buildSearchUrl,\n    parsePriceArg,\n    buildSearchFilter,\n    buildExtraFilterValue,\n};\n","sourceCodeStart":231,"sourceCodeEnd":263,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xianyu/search.js#L231-L263","documentation":"The search executed successfully but returned zero items, so an EmptyResultError is thrown for 'xianyu search'. The hint notes filters may be too narrow or the keyword has no listings.","triggerScenarios":"items array is present but empty: the keyword matched nothing, or price/province/city filters excluded every result.","commonSituations":"Very specific keywords, typos in the query, over-tight price ranges (e.g. --min-price 9000 --max-price 9001), filtering to a province/city with no matching listings.","solutions":["Broaden the query (use shorter, more generic keywords)","Widen or remove the price range and province/city filters","Retry the raw keyword without any --min-price/--max-price/--province/--city flags to confirm the keyword alone returns results"],"exampleFix":"// before\nxianyu search '索尼 a7m4 95新 国行' --min-price 12000 --max-price 12050 --province 上海\n// after\nxianyu search 'sony a7m4' --min-price 10000 --max-price 15000","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { return await xianyuSearch(args); } catch (e) { if (e instanceof EmptyResultError) { return await xianyuSearch({ ...args, query: broaden(args.query), 'min-price': undefined, 'max-price': undefined, province: undefined, city: undefined }); } throw e; }","preventionTips":["Start with broad queries and only tighten filters after confirming results exist","Loosen price ranges rather than pinning min≈max","Clear province/city filters when a region may lack listings","Handle EmptyResultError as a normal outcome, not a failure"],"tags":["empty-result","search","filtering"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}