{"record":{"id":"ff36a291ebd8adb9","repo":"jackwener/OpenCLI","slug":"dongchedi-search-keyword-no-car-series-match","errorCode":null,"errorMessage":"dongchedi search \"${keyword}\": No car series matched. Try the model name, e.g. \"宝马X5\" or \"汉兰达\".","messagePattern":"dongchedi search \"(.+?)\": No car series matched\\. Try the model name, e\\.g\\. \"宝马X5\" or \"汉兰达\"\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/dongchedi/search.js","lineNumber":76,"sourceCode":"    strategy: Strategy.PUBLIC,\n    browser: false,\n    args: [\n        { name: 'keyword', required: true, positional: true, help: '搜索关键词，例如 \"宝马X5\" 或 \"汉兰达\"' },\n        { name: 'limit', type: 'int', default: 15, help: '返回的车系数量（最多 30）' },\n    ],\n    columns: SEARCH_COLUMNS,\n    func: async (args) => {\n        const keyword = String(args.keyword || '').trim();\n        if (!keyword) throw new ArgumentError('keyword', 'must be a non-empty string');\n        const limit = requireLimit(args.limit, 15, 30);\n\n        const pp = await dcdFetchPageProps(\n            `/search?keyword=${encodeURIComponent(keyword)}`,\n            `search \"${keyword}\"`,\n        );\n        const rows = parseSearchRows(pp.searchData, limit);\n        if (rows.length === 0) {\n            throw new EmptyResultError(\n                `dongchedi search \"${keyword}\"`,\n                'No car series matched. Try the model name, e.g. \"宝马X5\" or \"汉兰达\".',\n            );\n        }\n        return rows;\n    },\n});\n","sourceCodeStart":58,"sourceCodeEnd":84,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/dongchedi/search.js#L58-L84","documentation":"An EmptyResultError thrown by the dongchedi search command (clis/dongchedi/search.js:76). The command fetched the SSR page for `/search?keyword=...`, parsed the car-series result rows from `searchData`, and found zero rows. The library throws this instead of returning an empty result so callers get an explicit, typed signal that the keyword did not match any car series on Dongchedi.","triggerScenarios":"Running the dongchedi search command with a keyword that matches no car series: a misspelled or transliterated model name, an English name when the site indexes Chinese names (e.g. \"BMW X5\" instead of \"宝马X5\"), a brand-only keyword, or a keyword that only matches articles/videos rather than car series.","commonSituations":"Developers hard-coding English model names, scripts feeding raw user input (typos, extra spaces, partial names) into search, or scraping after Dongchedi renamed/reindexed a series so a previously working keyword no longer resolves.","solutions":["Retry with the Chinese model name, e.g. \"宝马X5\" or \"汉兰达\", since Dongchedi indexes series by their Chinese names.","Check the keyword for typos, extra whitespace, or brand-only terms and use a specific series name instead.","Search the web for the model's official Chinese market name and use that exact string.","Catch EmptyResultError in the caller and treat it as 'no matches' rather than a crash, then prompt for a better keyword."],"exampleFix":"// before\nawait dcd.search(\"BMW X5\"); // EmptyResultError\n// after\nawait dcd.search(\"宝马X5\"); // matches the series","handlingStrategy":"try-catch","validationCode":"function isLikelySeriesKeyword(kw) {\n  const k = String(kw || '').trim();\n  return k.length >= 2 && /[\\u4e00-\\u9fff]/.test(k); // prefer non-empty Chinese model names\n}","typeGuard":null,"tryCatchPattern":"import { EmptyResultError } from '@jackwener/opencli/errors';\ntry {\n  const rows = await dcdSearch(keyword);\n} catch (err) {\n  if (err instanceof EmptyResultError) {\n    console.log(`No series matched \"${keyword}\"; try the Chinese model name.`);\n  } else throw err;\n}","preventionTips":["Always search using the model's official Chinese market name.","Trim and normalize keywords before searching.","Resolve ids via search instead of hard-coding names in scripts.","Catch EmptyResultError and treat it as 'no matches', not a crash."],"tags":["empty-result","search","dongchedi","user-input"],"backgroundTag":"search-returned-no-results","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}