DIYgod/RSSHub · warning · Error
resErrorText
Error message
resErrorText
What it means
Thrown by the Japan Post tracking route when the parsed tracking-history table (.tableType01 eq(1)) has no rows. The route then scrapes the human-readable error message Japan Post shows on the page (from the first table, row 2, cell 1) and re-throws it verbatim. The error message is therefore dynamic — whatever Japan Post displays (e.g. 'お問い合わせの番号は...'), often in Japanese.
Source
Thrown at lib/routes/japanpost/track.tsx:50
const list = $('.tableType01').eq(1).find('tr').slice(2);
const officeList = $('.tableType03').eq(0).find('tr').slice(1);
let officeItemList;
if (officeList.length) {
officeItemList = officeList.toArray().map((e) => {
const eTd = $(e).find('td');
return {
officeType: eTd.eq(0).text().trim(),
officeName: eTd.eq(1).html()!.trim(),
officeTel: eTd.eq(2).html()!.trim(),
};
});
}
if (!list.length) {
const resErrorText = $('.tableType01').eq(0).find('tr').eq(2).find('td').eq(1).text().trim();
throw new Error(resErrorText);
}
const listEven = utils.even(list);
const listOdd = utils.odd(list);
const packageType = $('.tableType01').eq(0).find('tr').eq(1).find('td').eq(1).text().trim();
const packageService = $('.tableType01').eq(0).find('tr').eq(1).find('td').eq(2).text().trim();
const serviceText = locale === 'ja' ? '付加サービス:' : 'Additional services: ';
let lastItemTimestamp;
let tz;
return {
title: `${baseTitle} ${reqCode} ${packageType}`,
link,
description: `${baseTitle} ${reqCode} ${packageType}`,
language: locale as Language,
icon: 'https://www.post.japanpost.jp/favicon.ico',View on GitHub (pinned to bed535e087)
Solutions
- Double-check the tracking number for typos and trim whitespace before submitting.
- Wait a few hours and retry if the package was just shipped — the number may not be registered yet.
- If the error text is in Japanese and unreadable, retry with locale=en in the route path.
- In the route itself, fall back to a generic English message when the scraped resErrorText is empty.
Example fix
// before
if (!list.length) {
const resErrorText = $('.tableType01').eq(0).find('tr').eq(2).find('td').eq(1).text().trim();
throw new Error(resErrorText);
}
// after — guard against an empty scraped message
if (!list.length) {
const resErrorText = $('.tableType01').eq(0).find('tr').eq(2).find('td').eq(1).text().trim();
throw new Error(resErrorText || `No tracking data found for ${reqCode}. The number may be invalid or not yet registered.`);
} Defensive patterns
Strategy: validation
Validate before calling
// Validate tracking number format before calling Japan Post
const reqCode = ctx.req.param('reqCode');
if (!/^[A-Za-z0-9]{10,25}$/.test(reqCode)) {
throw new InvalidParameterError(`Tracking number '${reqCode}' does not look valid (expected 10-25 alphanumeric chars).`);
} Try / catch
try {
// ...fetch and parse
if (!list.length) {
const resErrorText = $('.tableType01').eq(0).find('tr').eq(2).find('td').eq(1).text().trim();
throw new Error(resErrorText || `No tracking data for ${reqCode}`);
}
} catch (e) {
// Distinguish 'invalid number' from 'transient unavailable'
throw e;
} Prevention
- Sanitize the tracking number (trim whitespace, uppercase alphabetic codes).
- Retry after a few hours if a just-shipped package returns no data — registration lags.
- Display the raw Japan Post error text to end users; it is authoritative.
- Fall back to a generic English message if the scraped text is empty.
When it happens
Trigger: Tracking number is mistyped, not yet registered in the system, has already completed delivery and aged out, or belongs to a service Japan Post's domestic tracker does not cover. Any case where the tracking page renders an error table instead of a history table.
Common situations: User submits a tracking number with extra spaces or wrong format. A package was just shipped and the tracking number is not yet active (typically a few hours delay). A non-JapanPost number (e.g. a USPS number) is submitted. The locale is set to 'en' but the error text is still in Japanese because Japan Post's error rendering is locale-inconsistent.
Related errors
- countResponse.data.errors[0].message
- this route is empty, please check the original site or <a hr
- Unknown type: ${item.type}
- Comic Not Found - ${name}
- Empty content: ${articleUrl}
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/ab65dc73d0e20797.
Report an issue: GitHub.