{"record":{"id":"648bedf9b880cb95","repo":"jackwener/OpenCLI","slug":"no-12306-stations-match-keyword","errorCode":null,"errorMessage":"No 12306 stations match \"${keyword}\"","messagePattern":"No 12306 stations match \"(.+?)\"","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/12306/stations.js","lineNumber":42,"sourceCode":"    ],\n    columns: ['name', 'code', 'pinyin', 'abbr', 'city'],\n    func: async (kwargs) => {\n        const keyword = String(kwargs.keyword ?? '').trim();\n        if (!keyword) throw new ArgumentError('keyword must not be empty');\n        const limit = normalizeLimit(kwargs.limit, 20, MAX_LIMIT);\n\n        const stations = await fetchStationBundle();\n        const lower = keyword.toLowerCase();\n        const matches = stations.filter((s) =>\n            s.name.includes(keyword)\n            || s.code === keyword.toUpperCase()\n            || s.pinyin.includes(lower)\n            || s.abbr.includes(lower)\n            || s.short.includes(lower)\n            || s.city.includes(keyword),\n        );\n        if (matches.length === 0) {\n            throw new EmptyResultError(`No 12306 stations match \"${keyword}\"`);\n        }\n        return matches.slice(0, limit).map((s) => ({\n            name: s.name,\n            code: s.code,\n            pinyin: s.pinyin,\n            abbr: s.abbr,\n            city: s.city,\n        }));\n    },\n});\n","sourceCodeStart":24,"sourceCodeEnd":53,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/12306/stations.js#L24-L53","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n12306 stations Bejing   # typo\n// after\n12306 stations beij    # pinyin fragment -> 北京/北京南/北京西...","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  matches = await stationsCmd({ keyword });\n} catch (e) {\n  if (e instanceof EmptyResultError && /No 12306 stations match/.test(e.message)) {\n    // fallback: retry with a shorter prefix of the keyword\n    matches = await stationsCmd({ keyword: keyword.slice(0, 2) });\n  } else throw e;\n}","preventionTips":["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."],"tags":["empty-result","search","cli"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}