DIYgod/RSSHub · error · Error
暂时无法获取快递信息,请稍后重试...
Error message
暂时无法获取快递信息,请稍后重试...
What it means
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.
Source
Thrown at lib/routes/kuaidi100/utils.ts:254
const cookie = await getCookie();
const queryResponse = await got({
method: 'get',
url: `https://www.kuaidi100.com/query?type=${number}&postid=${id}&temp=${Math.random()}&phone=${phone ?? ''}`,
headers: {
Referer: 'https://www.kuaidi100.com/',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,ja;q=0.7',
Cookie: `${cookie.globacsrftoken}; ${cookie.csrf}; ${cookie.wwwid}; ${cookie.dasddocHref}; ${cookie.dasddocReferrer}; ${
cookie.dasddocTitl
}; addcom=${number}; addnu=${id}; snt_query_meta=${queryMeta}; sortStatus=0; Hm_lpvt_22ea01af58ba2be0fec7c11b25e88e6c=${timestamp}; Hm_lvt_22ea01af58ba2be0fec7c11b25e88e6c=${timestamp - 1642}`,
},
});
query = queryResponse.data;
if (query.status === '200') {
if (query.data && query.data[0].context === '查无结果') {
// 查无结果 appears when cookie is invaild, force update cookie.
clearCookie();
throw new Error('暂时无法获取快递信息,请稍后重试...');
}
if (query.ischeck === '0') {
// Not yet complete, don't cache for now.
// To avoid frquent link test when add source, add 180s cache
cache.set(query_key, query ?? '', 180);
} else {
cache.set(query_key, query ?? ''); // Finished, cache id
}
} else {
cache.set(query_key, query ?? ''); // Error, cache as well
throw new Error(`[${query.status}]信息有误,请重新检查后订阅:${query.message}`);
}
}
return query;
},
};
View on GitHub (pinned to bed535e087)
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
Example fix
// before
if (query.data && query.data[0].context === '查无结果') {
clearCookie();
throw new Error('暂时无法获取快递信息,请稍后重试...');
}
// after — make the retry semantics explicit and log the trigger
if (query.data && query.data[0].context === '查无结果') {
clearCookie();
logger.warn(`kuaidi100: 查无结果 for ${number}/${id}, cookie cleared — retry will re-auth`);
throw new Error('暂时无法获取快递信息,cookie 已刷新,请稍后重试...');
} Defensive patterns
Strategy: retry
Validate before calling
// getQuery already self-heals via clearCookie; callers should retry once
async function queryWithReauth(number: string, id: string, phone?: string) {
try { return await utils.getQuery(number, id, phone); }
catch (e) {
if (e instanceof Error && /暂时无法获取/.test(e.message)) {
await new Promise((r) => setTimeout(r, 1500));
return await utils.getQuery(number, id, phone);
}
throw e;
}
} Type guard
function isCookieInvalidResult(query: { status: string; data?: { context?: string }[] }): boolean {
return query.status === '200' && query.data?.[0]?.context === '查无结果';
} Try / catch
try { return await utils.getQuery(number, id, phone); }
catch (e) {
if (e instanceof Error && e.message.includes('暂时无法获取')) {
// clearCookie already ran upstream — retry re-acquires credentials
return await utils.getQuery(number, id, phone);
}
throw e;
} Prevention
- 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
When it happens
Trigger: 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'.
Common situations: 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.
Related errors
- 遇到源站风控校验,请稍后再试
- 缺少 Medium 用户 ${user} 登录后的 Cookie 值
- Medium 用户 ${user} 的 Cookie 无效或已过期
- 缺少 Medium 用户 ${user} 登录后的 Cookie 值
- Medium 用户 ${user} 的 Cookie 无效或已过期
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/c62682e25c6c97ce.
Report an issue: GitHub.