FuelLabs/fuels-ts · error · FuelError
WALLET_MANAGER_ERROR
WALLET_MANAGER_ERROR
Error message
Account with address '${address}' not found in derived wallets. What it means
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.
Source
Thrown at packages/account/src/wallet-manager/vaults/mnemonic-vault.ts:85
return {
publicKey: wallet.publicKey,
address: wallet.address,
};
}
exportAccount(address: AddressInput): string {
let numberOfAccounts = 0;
const ownerAddress = new Address(address);
// Look for the account that has the same address
do {
const wallet = Wallet.fromMnemonic(this.#secret, this.getDerivePath(numberOfAccounts));
if (wallet.address.equals(ownerAddress)) {
return wallet.privateKey;
}
numberOfAccounts += 1;
} while (numberOfAccounts < this.numberOfAccounts);
throw new FuelError(
ErrorCode.WALLET_MANAGER_ERROR,
`Account with address '${address}' not found in derived wallets.`
);
}
getWallet(address: AddressInput): WalletUnlocked {
const privateKey = this.exportAccount(address);
return Wallet.fromPrivateKey(privateKey);
}
}
View on GitHub (pinned to b3f37c91ac)
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).
Example fix
// before
const pk = mnemonicVault.exportAccount(externalAddress); // not derived
// after
const accounts = mnemonicVault.getAccounts();
const match = accounts.find(a => a.address.equals(target));
if (!match) { mnemonicVault.addAccount(); /* retry */ } Defensive patterns
Strategy: validation
Validate before calling
const accounts = mnemonicVault.getAccounts();
const known = accounts.some(a => a.address.equals(new Address(target)));
if (!known) throw new Error('Address not in mnemonic vault'); Type guard
const vaultHasAddress = (v: MnemonicVault, addr: AddressInput): boolean => v.getAccounts().some(a => a.address.equals(new Address(addr)));
Try / catch
try { return vault.exportAccount(addr); }
catch (e) {
if (e instanceof FuelError && e.code === ErrorCode.WALLET_MANAGER_ERROR) {
vault.addAccount(); return vault.exportAccount(addr);
}
throw e;
} Prevention
- Persist numberOfAccounts correctly so all derived indices remain accessible.
- Verify the derivation path matches across sessions.
- Use getAccounts() to enumerate before exporting.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
AI-assisted analysis of FuelLabs/fuels-ts@b3f37c91ac (2026-08-12).
Data as JSON: /api/errors/c3e9c3d49d55bf2b.
Report an issue: GitHub.