fix(python): correct CLI error message on uninitialized device
What changed, and why it matters
This is a tiny user-interface fix in the Trezor Python command-line library. When a user runs a command on a brand-new, uninitialised Trezor, the tool now prints 'Device is not initialized.' instead of falling through to a generic 'Failed to find a Trezor device.' message. It does not change device firmware, crypto handling, or any security boundary; it only makes the error text clearer.
No security action required. Treat as a normal UX fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit adds one exception handler in python/src/trezorlib/cli/init.py. It catches trezorlib.exceptions.DerivationOnUninitaizedDeviceError (note the typo in the exception name is in the source) and exits with a specific ‘Device is not initialized.’ message. The change is purely presentational: it does not alter session resumption, device enumeration, derivation logic, or any authentication flow. No security bug is fixed or introduced.
Changed components
python/src/trezorlib/cli/__init__.pyInspect captured patch +3 / −0
diff --git a/python/src/trezorlib/cli/__init__.py b/python/src/trezorlib/cli/__init__.py
index 2d332e509..c1f0b5d58 100644
--- a/python/src/trezorlib/cli/__init__.py
+++ b/python/src/trezorlib/cli/__init__.py
@@ -307,6 +307,9 @@ class TrezorConnection:
sys.exit(1)
except exceptions.FailedSessionResumption:
sys.exit(1)
+ except exceptions.DerivationOnUninitaizedDeviceError:
+ click.echo("Device is not initialized.")
+ sys.exit(1)
except Exception:
click.echo("Failed to find a Trezor device.")
if self.path is not None:
Why this scored 19/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.