{"record":{"id":"17ea14cceafb6e17","repo":"FuelLabs/fuels-ts","slug":"invalid-mnemonic-17ea14","errorCode":"INVALID_MNEMONIC","errorMessage":"Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.","messagePattern":"Invalid mnemonic: the word '(.+?)' is not found in the provided wordlist\\.","errorType":"validation","errorClass":"FuelError","httpStatus":null,"severity":"error","filePath":"packages/account/src/mnemonic/utils.ts","lineNumber":74,"sourceCode":"  const checksumBits = entropy.length / 4;\n  const checksum = arrayify(sha256(entropy))[0] & getUpperMask(checksumBits);\n\n  // Shift the checksum into the word indices\n  indices[indices.length - 1] <<= checksumBits;\n  indices[indices.length - 1] |= checksum >> (8 - checksumBits);\n\n  return indices;\n}\n\nexport function mnemonicWordsToEntropy(words: Array<string>, wordlist: Array<string>): BytesLike {\n  const size = Math.ceil((11 * words.length) / 8);\n  const entropy = arrayify(new Uint8Array(size));\n\n  let offset = 0;\n  for (let i = 0; i < words.length; i += 1) {\n    const index = wordlist.indexOf(words[i].normalize('NFKD'));\n    if (index === -1) {\n      throw new FuelError(\n        ErrorCode.INVALID_MNEMONIC,\n        `Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`\n      );\n    }\n\n    for (let bit = 0; bit < 11; bit += 1) {\n      if (index & (1 << (10 - bit))) {\n        entropy[offset >> 3] |= 1 << (7 - (offset % 8));\n      }\n      offset += 1;\n    }\n  }\n  const entropyBits = (32 * words.length) / 3;\n  const checksumBits = words.length / 3;\n  const checksumMask = getUpperMask(checksumBits);\n  const checksum = arrayify(sha256(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;\n\n  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/packages/account/src/mnemonic/utils.ts#L56-L92","documentation":"Thrown by mnemonicWordsToEntropy when a word in the mnemonic phrase cannot be found in the provided wordlist. The function maps each word to an 11-bit index via wordlist.indexOf; a return of -1 means the word is not part of the (default English) BIP-39 wordlist. NFKD normalization is applied before lookup, so visually similar words still must match a canonical entry.","triggerScenarios":"Calling mnemonicToEntropy on a phrase containing a typo, a word from a different language wordlist, a non-BIP-39 word, or extra punctuation; passing a custom wordlist that omits a word; mixing wordlists (e.g. Japanese words with the default English list).","commonSituations":"User mistyped a seed word (e.g. 'aple' instead of 'apple'); phrase was OCR'd or auto-corrected, substituting a real but wrong word; phrase contains words from another BIP-39 language; copy-paste included a trailing comma or period attached to a word.","solutions":["Inspect the exact word reported in the error message and correct the typo against the BIP-39 English wordlist.","Strip surrounding punctuation/whitespace from each word before passing: words.map(w => w.trim().replace(/[^a-z]/gi, '')).","If using a non-English phrase, construct Mnemonic with the matching wordlist (e.g. japanese) instead of the default english.","Validate each word with wordlist.includes(word) before calling mnemonicToEntropy to surface the bad word early."],"exampleFix":"// before\nconst entropy = Mnemonic.mnemonicToEntropy('abandon ability abndon about ...'); // 'abndon' typo\n\n// after\n// fix the typo to a valid word\nconst entropy = Mnemonic.mnemonicToEntropy('abandon ability abandon about ...');\n\n// or pre-validate\nconst words = phrase.trim().split(/\\s+/);\nconst bad = words.filter(w => !english.includes(w));\nif (bad.length) throw new Error(`Unknown words: ${bad.join(', ')}`);","handlingStrategy":"validation","validationCode":"import { english } from '@fuel-ts/account/wordlists';\nfunction validateWords(words: string[], wordlist = english) {\n  const unknown = words.filter(w => !wordlist.includes(w.normalize('NFKD')));\n  if (unknown.length) throw new Error(`Unknown mnemonic words: ${unknown.join(', ')}`);\n}","typeGuard":"function allWordsInList(words: string[], wordlist: string[]): boolean {\n  return words.every(w => wordlist.includes(w.normalize('NFKD')));\n}","tryCatchPattern":"import { FuelError, ErrorCode } from '@fuel-ts/errors';\ntry {\n  const entropy = mnemonicWordsToEntropy(words, wordlist);\n} catch (e) {\n  if (e instanceof FuelError && e.code === ErrorCode.INVALID_MNEMONIC) {\n    // show the offending word from the message to the user for correction\n  }\n  throw e;\n}","preventionTips":["Strip punctuation and normalize NFKD before lookup.","Match the wordlist language to the phrase language.","Validate words against the wordlist before entropy recovery."],"tags":["mnemonic","bip39","validation","wallet"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}