{"record":{"id":"bcae53bf4800474e","repo":"jackwener/OpenCLI","slug":"no-mdn-results-matched-query-locale-locale","errorCode":null,"errorMessage":"No MDN results matched \"${query}\" (locale ${locale}).","messagePattern":"No MDN results matched \"(.+?)\" \\(locale (.+?)\\)\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"info","filePath":"clis/mdn/search.js","lineNumber":86,"sourceCode":"        if (resp.status === 429) {\n            throw new CommandExecutionError(\n                'mdn search returned HTTP 429 (rate limited)',\n                'MDN throttles bursty traffic; wait a few seconds and retry.',\n            );\n        }\n        if (!resp.ok) {\n            throw new CommandExecutionError(`mdn search returned HTTP ${resp.status}`);\n        }\n        let body;\n        try {\n            body = await resp.json();\n        }\n        catch (err) {\n            throw new CommandExecutionError(`mdn search returned malformed JSON: ${err?.message ?? err}`);\n        }\n        const docs = Array.isArray(body?.documents) ? body.documents : [];\n        if (!docs.length) {\n            throw new EmptyResultError('mdn search', `No MDN results matched \"${query}\" (locale ${locale}).`);\n        }\n        return docs.slice(0, limit).map((doc, i) => ({\n            rank: i + 1,\n            title: String(doc.title ?? ''),\n            slug: String(doc.slug ?? ''),\n            locale: String(doc.locale ?? locale),\n            summary: String(doc.summary ?? '').replace(/\\s+/g, ' ').trim(),\n            url: doc.mdn_url ? `${MDN_BASE}${doc.mdn_url}` : '',\n        }));\n    },\n});\n","sourceCodeStart":68,"sourceCodeEnd":98,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/mdn/search.js#L68-L98","documentation":"EmptyResultError thrown when the MDN search API responds successfully but returns zero documents for the query and locale. This is a signal that nothing matched, not a malfunction — the message includes the query and locale for clarity.","triggerScenarios":"Searching a term MDN has no page for; misspelled API/class names; searching in a locale where the article does not exist (docs array is empty for that locale).","commonSituations":"Typos in API names ('queryselector al'); obscure or very new features not yet documented; non-en-US locales with missing translations; overly specific multi-word queries.","solutions":["Rephrase or shorten the query (e.g. 'array reduce' instead of a full sentence).","Retry with locale 'en-US', which has the most complete coverage.","Check spelling of the API/feature name.","Try related or broader terms (e.g. 'map' instead of 'typed array map constructor')."],"exampleFix":"// before\nawait mdnSearch({ query: 'querySelectorr All', locale: 'ja' });\n// after\ntry {\n  return await mdnSearch({ query: 'querySelectorAll', locale: 'ja' });\n} catch (e) {\n  if (String(e.message).includes('No MDN results')) {\n    return await mdnSearch({ query: 'querySelectorAll', locale: 'en-US' });\n  }\n  throw e;\n}","handlingStrategy":"fallback","validationCode":"if (!query || !query.trim()) return []; // avoid pointless no-match requests","typeGuard":null,"tryCatchPattern":"try { return await mdnSearch({ query, locale }); } catch (e) {\n  if (String(e.message).includes('No MDN results')) return suggestAlternatives(query);\n  throw e;\n}","preventionTips":["Normalize/spellcheck queries before searching","Fall back to en-US when localized results are empty","Offer related-term suggestions on empty results","Prefer shorter, keyword-style queries"],"tags":["empty-result","search","i18n"],"backgroundTag":"empty-search-results","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}