{"record":{"id":"c62682e25c6c97ce","repo":"DIYgod/RSSHub","slug":"error-c62682","errorCode":null,"errorMessage":"暂时无法获取快递信息，请稍后重试...","messagePattern":"暂时无法获取快递信息，请稍后重试\\.\\.\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/routes/kuaidi100/utils.ts","lineNumber":254,"sourceCode":"            const cookie = await getCookie();\n            const queryResponse = await got({\n                method: 'get',\n                url: `https://www.kuaidi100.com/query?type=${number}&postid=${id}&temp=${Math.random()}&phone=${phone ?? ''}`,\n                headers: {\n                    Referer: 'https://www.kuaidi100.com/',\n                    'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,ja;q=0.7',\n                    Cookie: `${cookie.globacsrftoken}; ${cookie.csrf}; ${cookie.wwwid}; ${cookie.dasddocHref}; ${cookie.dasddocReferrer}; ${\n                        cookie.dasddocTitl\n                    }; addcom=${number}; addnu=${id}; snt_query_meta=${queryMeta}; sortStatus=0; Hm_lpvt_22ea01af58ba2be0fec7c11b25e88e6c=${timestamp}; Hm_lvt_22ea01af58ba2be0fec7c11b25e88e6c=${timestamp - 1642}`,\n                },\n            });\n\n            query = queryResponse.data;\n            if (query.status === '200') {\n                if (query.data && query.data[0].context === '查无结果') {\n                    // 查无结果 appears when cookie is invaild, force update cookie.\n                    clearCookie();\n                    throw new Error('暂时无法获取快递信息，请稍后重试...');\n                }\n                if (query.ischeck === '0') {\n                    // Not yet complete, don't cache for now.\n                    // To avoid frquent link test when add source, add 180s cache\n                    cache.set(query_key, query ?? '', 180);\n                } else {\n                    cache.set(query_key, query ?? ''); // Finished, cache id\n                }\n            } else {\n                cache.set(query_key, query ?? ''); // Error, cache as well\n                throw new Error(`[${query.status}]信息有误，请重新检查后订阅：${query.message}`);\n            }\n        }\n\n        return query;\n    },\n};\n","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/kuaidi100/utils.ts#L236-L272","documentation":"Thrown by kuaidi100's getQuery when the query API returns status==='200' but the first data entry's context is exactly '查无结果' ('no result found'). The code comments indicate this string is a known signal that the session cookie is invalid; the handler calls clearCookie() to invalidate the cached session and throws so the next request re-acquires credentials.","triggerScenarios":"GET /query?type=<number>&postid=<id>&... returns HTTP 200 with status '200', but data[0].context === '查无结果'. This is 快递100's way of saying 'auth/session invalid' rather than 'tracking number unknown'.","commonSituations":"Cached wwwid/csrf cookies expired or were revoked server-side; rapid requests exhausted the per-session quota (max_query_count=30); the cookie-acquisition flow in getCookie() silently stored empty values; tracking number genuinely unknown but surfaced as the cookie-invalid signal.","solutions":["Retry the request — clearCookie() already ran, so the next call re-fetches cookies via getCookie()","If it persists, verify getCookie() actually populates wwwid/csrf (check the set-cookie parsing switch in lib/routes/kuaidi100/utils.ts:32-60)","Confirm the tracking number + company combination is real (a wrong combo can also surface as 查无结果)","Rate-limit your polling — exceeding 30 queries per cookie cycle triggers cookie invalidation"],"exampleFix":"// before\nif (query.data && query.data[0].context === '查无结果') {\n    clearCookie();\n    throw new Error('暂时无法获取快递信息，请稍后重试...');\n}\n// after — make the retry semantics explicit and log the trigger\nif (query.data && query.data[0].context === '查无结果') {\n    clearCookie();\n    logger.warn(`kuaidi100: 查无结果 for ${number}/${id}, cookie cleared — retry will re-auth`);\n    throw new Error('暂时无法获取快递信息，cookie 已刷新，请稍后重试...');\n}","handlingStrategy":"retry","validationCode":"// getQuery already self-heals via clearCookie; callers should retry once\nasync function queryWithReauth(number: string, id: string, phone?: string) {\n  try { return await utils.getQuery(number, id, phone); }\n  catch (e) {\n    if (e instanceof Error && /暂时无法获取/.test(e.message)) {\n      await new Promise((r) => setTimeout(r, 1500));\n      return await utils.getQuery(number, id, phone);\n    }\n    throw e;\n  }\n}","typeGuard":"function isCookieInvalidResult(query: { status: string; data?: { context?: string }[] }): boolean {\n  return query.status === '200' && query.data?.[0]?.context === '查无结果';\n}","tryCatchPattern":"try { return await utils.getQuery(number, id, phone); }\ncatch (e) {\n  if (e instanceof Error && e.message.includes('暂时无法获取')) {\n    // clearCookie already ran upstream — retry re-acquires credentials\n    return await utils.getQuery(number, id, phone);\n  }\n  throw e;\n}","preventionTips":["Always retry once after a 查无结果 — clearCookie has already refreshed state","Rate-limit polling to stay under max_query_count=30 per cookie cycle","Verify getCookie populates wwwid/csrf non-empty after acquisition","Distinguish cookie-invalid (retryable) from genuinely-unknown tracking numbers"],"tags":["retry","cookie","auth","transient"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}