TrezorConnect uses a consistent error handling pattern across all methods. Every method returns a result object with a success field that indicates whether the operation completed successfully.
const result = await TrezorConnect.getAddress({ /* ... */ });if (!result.success) { switch (result.error.code) { case 'Device_NotFound': showMessage('Please connect your Trezor device'); break; case 'Device_Disconnected': showMessage('Device was disconnected. Please reconnect.'); break; case 'Device_UsedElsewhere': showMessage('Device is being used by another application'); break; case 'Device_InvalidState': showMessage('Incorrect passphrase entered'); break; }}
Method Errors
Errors during method execution:
Error Code
Message
Cause
Method_InvalidParameter
Invalid parameter
Invalid method parameters
Method_NotAllowed
Method not allowed
Method unavailable in current mode
Method_PermissionsNotGranted
Permissions not granted
User denied permission
Method_Cancel
Canceled
User canceled operation
Method_Interrupted
Popup closed
Popup/window closed
Method_UnknownCoin
Coin not found
Invalid coin identifier
Method_AddressNotMatch
Addresses do not match
Address validation failed
const result = await TrezorConnect.getAddress({ path: "m/49'/0'/0'/0/0", coin: 'btc', address: 'expected-address'});if (!result.success) { if (result.error.code === 'Method_AddressNotMatch') { showError('Address mismatch - possible security issue!'); }}
Transport Errors
Communication layer errors:
Error Code
Message
Cause
Transport_Missing
Transport is missing
No transport available
Popup_ConnectionMissing
Unable to establish connection
Communication failure
import { TRANSPORT_EVENT, TRANSPORT } from '@trezor/connect';TrezorConnect.on(TRANSPORT_EVENT, (event) => { if (event.type === TRANSPORT.ERROR) { console.error('Transport error:', event.payload.error); if (event.payload.code === 'Transport_Missing') { showMessage('Please install Trezor Bridge'); } }});
Backend Errors
Blockchain backend errors:
Error Code
Message
Cause
Backend_NotSupported
BlockchainLink settings not found
No backend for this coin
Backend_Disconnected
Backend disconnected
Lost connection to backend
Backend_Invalid
Invalid backend
Wrong backend configuration
Backend_Error
(varies)
Backend-specific error
const result = await TrezorConnect.getAccountInfo({ path: "m/84'/0'/0'", coin: 'btc'});if (!result.success) { if (result.error.code === 'Backend_Disconnected') { showMessage('Lost connection to blockchain. Reconnecting...'); // Will automatically reconnect }}
Firmware Errors
Firmware-related errors:
Error Code
Message
Cause
Device_FwException
(varies)
Firmware version issue
Firmware_Old
Device firmware is too old
Outdated firmware
Firmware_Outdated
Firmware update recommended
Non-critical update available
Firmware_NotSupported
Firmware not supported
Unsupported version
import { UI_EVENT, UI_REQUEST } from '@trezor/connect';TrezorConnect.on(UI_EVENT, async (event) => { if (event.type === UI_REQUEST.FIRMWARE_OLD) { const shouldUpdate = await confirm( 'Your firmware is outdated. Update now?' ); if (shouldUpdate) { await TrezorConnect.firmwareUpdate(); } }});
function getUserFriendlyMessage(errorCode: string): string { const messages: Record<string, string> = { 'Device_NotFound': 'Please connect your Trezor device and try again.', 'Device_Disconnected': 'Your Trezor was disconnected. Please reconnect it.', 'Device_UsedElsewhere': 'Your Trezor is being used by another application. Please close other apps and try again.', 'Device_InvalidState': 'The passphrase you entered doesn\'t match. Please try again.', 'Method_Cancel': 'You canceled the operation.', 'Method_PermissionsNotGranted': 'Permission denied. Please approve the request on your device.', 'Transport_Missing': 'Trezor Bridge is not installed or running. Please install it from trezor.io/start', 'Backend_Disconnected': 'Lost connection to blockchain. Please check your internet connection.', 'Firmware_Old': 'Your Trezor firmware is outdated. Please update it for security.', }; return messages[errorCode] || 'An unexpected error occurred. Please try again.';}// Usageconst result = await TrezorConnect.signTransaction({ /* ... */ });if (!result.success) { const friendlyMessage = getUserFriendlyMessage(result.error.code); showNotification(friendlyMessage, 'error');}