jackwener/OpenCLI · warning · EmptyResultError
No 12306 stations match "${keyword}"
Error message
No 12306 stations match "${keyword}" What it means
This EmptyResultError is thrown when the keyword is valid but no station in the fetched 12306 station bundle matches it across name, pinyin, abbr, short, or city fields. It signals a search miss, not a malfunction — the station bundle simply has no such station.
Source
Thrown at clis/12306/stations.js:42
],
columns: ['name', 'code', 'pinyin', 'abbr', 'city'],
func: async (kwargs) => {
const keyword = String(kwargs.keyword ?? '').trim();
if (!keyword) throw new ArgumentError('keyword must not be empty');
const limit = normalizeLimit(kwargs.limit, 20, MAX_LIMIT);
const stations = await fetchStationBundle();
const lower = keyword.toLowerCase();
const matches = stations.filter((s) =>
s.name.includes(keyword)
|| s.code === keyword.toUpperCase()
|| s.pinyin.includes(lower)
|| s.abbr.includes(lower)
|| s.short.includes(lower)
|| s.city.includes(keyword),
);
if (matches.length === 0) {
throw new EmptyResultError(`No 12306 stations match "${keyword}"`);
}
return matches.slice(0, limit).map((s) => ({
name: s.name,
code: s.code,
pinyin: s.pinyin,
abbr: s.abbr,
city: s.city,
}));
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Try a shorter substring: `12306 stations 北京` instead of a full station name.
- Search by pinyin fragment in lowercase (`shangha`) rather than English translation.
- Look up the exact station via `12306 stations <city>` to list stations in that city and use its `code`/`name`.
- Use the station telecode from `12306 stations` output if you know it.
Example fix
// before 12306 stations Bejing # typo // after 12306 stations beij # pinyin fragment -> 北京/北京南/北京西...
Defensive patterns
Strategy: fallback
Try / catch
try {
matches = await stationsCmd({ keyword });
} catch (e) {
if (e instanceof EmptyResultError && /No 12306 stations match/.test(e.message)) {
// fallback: retry with a shorter prefix of the keyword
matches = await stationsCmd({ keyword: keyword.slice(0, 2) });
} else throw e;
} Prevention
- Search with short pinyin fragments or Chinese substrings, not full English names.
- If unsure of the exact station, search by city and pick from the listed results.
- Treat EmptyResultError as a search miss and widen the keyword rather than retrying identically.
When it happens
Trigger: Searching a non-existent station name, misspelled pinyin (e.g. 'shanhai'), a telecode that doesn't exist, or an English word 12306 has no data for; searching a bus stop or metro station that isn't a rail station.
Common situations: Typos in pinyin; using English names ('Beijing' works only via pinyin fragment 'beijing'); searching stations on a new line not present in the cached/fetched bundle; confusing city with station name.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- No matching spaces on huggingface.co.
- No prices returned for train_no=${trainNo} ${fromStation.nam
- ${label}
- ${label} cannot be empty
- No papers found for author "${authorText}". Try alternate sp
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/648bedf9b880cb95.
Report an issue: GitHub.