From 8e5ab068de6451d6fb3312515b52f9df347fba96 Mon Sep 17 00:00:00 2001 From: Simma Lohit Date: Mon, 19 Jan 2026 21:54:26 +0530 Subject: [PATCH] Improve error message for missing required arguments :wq# --- fire/core.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/fire/core.py b/fire/core.py index 8e23e76b..6051844e 100644 --- a/fire/core.py +++ b/fire/core.py @@ -687,7 +687,18 @@ def _CallAndUpdateTrace(component, args, component_trace, treatment='class', # Event loop is already running component = loop.run_until_complete(fn(*varargs, **kwargs)) else: - component = fn(*varargs, **kwargs) + try: + component = fn(*varargs, **kwargs) + except TypeError as e: + message = str(e) + + if 'missing' in message and 'required positional argument' in message: + raise TypeError( + f"Error: {message}\n\n" + f"Hint: Run the command with --help to see usage." + ) from None + + raise if treatment == 'class': action = trace.INSTANTIATED_CLASS