{"record":{"id":"c3e9c3d49d55bf2b","repo":"FuelLabs/fuels-ts","slug":"wallet-manager-error","errorCode":"WALLET_MANAGER_ERROR","errorMessage":"Account with address '${address}' not found in derived wallets.","messagePattern":"Account with address '(.+?)' not found in derived wallets\\.","errorType":"exception","errorClass":"FuelError","httpStatus":null,"severity":"error","filePath":"packages/account/src/wallet-manager/vaults/mnemonic-vault.ts","lineNumber":85,"sourceCode":"    return {\n      publicKey: wallet.publicKey,\n      address: wallet.address,\n    };\n  }\n\n  exportAccount(address: AddressInput): string {\n    let numberOfAccounts = 0;\n    const ownerAddress = new Address(address);\n    // Look for the account that has the same address\n    do {\n      const wallet = Wallet.fromMnemonic(this.#secret, this.getDerivePath(numberOfAccounts));\n      if (wallet.address.equals(ownerAddress)) {\n        return wallet.privateKey;\n      }\n      numberOfAccounts += 1;\n    } while (numberOfAccounts < this.numberOfAccounts);\n\n    throw new FuelError(\n      ErrorCode.WALLET_MANAGER_ERROR,\n      `Account with address '${address}' not found in derived wallets.`\n    );\n  }\n\n  getWallet(address: AddressInput): WalletUnlocked {\n    const privateKey = this.exportAccount(address);\n    return Wallet.fromPrivateKey(privateKey);\n  }\n}\n","sourceCodeStart":67,"sourceCodeEnd":96,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/packages/account/src/wallet-manager/vaults/mnemonic-vault.ts#L67-L96","documentation":"Thrown by MnemonicVault.exportAccount() after iterating all derived accounts (indices 0..numberOfAccounts-1) without finding one whose address equals the requested address. The vault can only export keys for addresses it has already derived; an unknown address yields WALLET_MANAGER_ERROR.","triggerScenarios":"Calling mnemonicVault.exportAccount(address) or walletManager.exportWallet(address) with an address that is not among the first 'numberOfAccounts' derived from the mnemonic at the vault's derivation path. Also when numberOfAccounts was reduced after the address was originally added.","commonSituations":"Passing an externally-sourced address that was never added to the mnemonic vault; derivation path changed between sessions; numberOfAccounts deserialization from storage yielded a smaller count; address string format mismatch (checksum vs b256) — though Address comparison normalizes this.","solutions":["Ensure the address belongs to a derived account: call vault.addAccount() or raise numberOfAccounts until the address appears in getAccounts().","Verify the mnemonic and rootPath match those used to originally derive the address.","Check persisted wallet-manager state for the correct numberOfAccounts value.","If the address is from a different source, use the appropriate vault type (e.g. PrivateKeyVault)."],"exampleFix":"// before\nconst pk = mnemonicVault.exportAccount(externalAddress); // not derived\n// after\nconst accounts = mnemonicVault.getAccounts();\nconst match = accounts.find(a => a.address.equals(target));\nif (!match) { mnemonicVault.addAccount(); /* retry */ }","handlingStrategy":"validation","validationCode":"const accounts = mnemonicVault.getAccounts();\nconst known = accounts.some(a => a.address.equals(new Address(target)));\nif (!known) throw new Error('Address not in mnemonic vault');","typeGuard":"const vaultHasAddress = (v: MnemonicVault, addr: AddressInput): boolean => v.getAccounts().some(a => a.address.equals(new Address(addr)));","tryCatchPattern":"try { return vault.exportAccount(addr); }\ncatch (e) {\n  if (e instanceof FuelError && e.code === ErrorCode.WALLET_MANAGER_ERROR) {\n    vault.addAccount(); return vault.exportAccount(addr);\n  }\n  throw e;\n}","preventionTips":["Persist numberOfAccounts correctly so all derived indices remain accessible.","Verify the derivation path matches across sessions.","Use getAccounts() to enumerate before exporting."],"tags":["wallet-manager","mnemonic","vault","export","account"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}