pot-app/pot-desktop · warning · Error

Words not yet included: ${text}

Error message

Words not yet included: ${text}

What it means

After a successful (2xx) fetch, the service parses the HTML and queries for `.pr.entry-body__el` nodes — the containers holding dictionary entries. If none are found, Cambridge returned a page with no dictionary entry for the queried word, so the service throws this error instead of returning an empty result. The library does this because its parser relies entirely on that DOM structure.

Source

Thrown at src/services/translate/cambridge_dict/index.jsx:58

        return '';
    }

    const url = `https://dictionary.cambridge.org/search/direct/?datasetsearch=${from}-${to}&q=${text}`;
    let res = await fetch(url, {
        method: 'GET',
        headers: {
            'Content-Type': 'text/html;charset=UTF-8',
        },
        responseType: 2,
    });

    if (!res.ok) {
        throw new Error(`Http Request Error\nHttp Status: ${res.status}\n${JSON.stringify(res.data)}`);
    }
    const doc = new DOMParser().parseFromString(res.data, 'text/html');
    const entryNodes = doc.querySelectorAll('.pr.entry-body__el');
    if (entryNodes.length === 0) {
        throw new Error(`Words not yet included: ${text}`);
    }

    const resultMap = [...entryNodes].reduce((dict, entryNode) => {
        const wordTranslateResult = dict['result'] || new WordTranslateResult([], []);

        if (wordTranslateResult.pronunciations.length === 0) {
            const pronunciationNodes = entryNode.querySelectorAll('.dpron-i');
            const pronunciations = [...pronunciationNodes].map((pronunciationNode) => {
                const region = pronunciationNode.querySelector('.region').innerText;
                const symbol = pronunciationNode.querySelector('.pron').innerText;
                let voice = pronunciationNode.querySelector('.daud source').src;
                voice = voice.replace(/^https?:\/\/[^/]+/, 'https://dictionary.cambridge.org');
                voice = voice.replace(/^tauri:\/\/[^/]+/, 'https://dictionary.cambridge.org');
                return new Pronunciation(region, symbol, voice);
            });
            wordTranslateResult.pronunciations.push(...pronunciations);
        }

View on GitHub (pinned to 594d32ede9)

Solutions

  1. Check the spelling of the queried word and correct it before translating.
  2. Use a different translation service (e.g. an LLM or Bing) for words not in the Cambridge dictionary.
  3. If this happens for words that DO exist on the website, inspect the returned HTML — Cambridge likely changed its CSS classes; update the `.pr.entry-body__el` selector.
  4. Treat this error as expected behavior for unknown words and show a friendly 'not found' message instead of a stack trace.

Example fix

// before
if (entryNodes.length === 0) {
    throw new Error(`Words not yet included: ${text}`);
}
// after
if (entryNodes.length === 0) {
    return ''; // or return new WordTranslateResult([], []) to degrade gracefully
}
Defensive patterns

Strategy: fallback

Validate before calling

const likelyDictionaryWord = (text) => /^[A-Za-z][A-Za-z'-]*$/.test(text.trim());
if (!likelyDictionaryWord(text)) return ''; // names, typos, multi-words won't be in the dictionary

Type guard

function hasDictionaryEntries(doc) {
  return doc.querySelectorAll('.pr.entry-body__el').length > 0;
}

Try / catch

try {
  const result = await cambridgeTranslate(word, 'en', to);
} catch (e) {
  if (String(e.message).startsWith('Words not yet included')) {
    return null; // render as 'word not found', not as an error
  }
  throw e;
}

Prevention

When it happens

Trigger: translate(text, from, to) receives a single English word (passes the guard at line 39) but Cambridge has no entry for it: misspelled words, proper nouns, slang, very new/rare terms, or non-English input that slipped through auto-detection.

Common situations: User highlights a misspelled word or a brand/product name and triggers the Cambridge dictionary service; Cambridge page layout changes removing the `entry-body__el` class; the word exists only in a different dictionary dataset than the selected from-to pair.

Related errors


AI-assisted analysis of pot-app/pot-desktop@594d32ede9 (2026-09-02). Data as JSON: /api/errors/36571479e1022800. Report an issue: GitHub.