{"record":{"id":"4666ac5ff2480315","repo":"google/python-fire","slug":"unsupported-callable","errorCode":null,"errorMessage":"Unsupported callable.","messagePattern":"Unsupported callable\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"fire/inspectutils.py","lineNumber":112,"sourceCode":"  This function instead skips bound args (self) and follows wrapped chains.\n\n  Args:\n    fn: The function or class of interest.\n  Returns:\n    An inspect.FullArgSpec namedtuple with the full arg spec of the function.\n  \"\"\"\n  # pylint: disable=no-member\n\n  try:\n    sig = inspect._signature_from_callable(  # pylint: disable=protected-access  # type: ignore\n        fn,\n        skip_bound_arg=True,\n        follow_wrapper_chains=True,\n        sigcls=inspect.Signature)\n  except Exception:\n    # 'signature' can raise ValueError (most common), AttributeError, and\n    # possibly others. We catch all exceptions here, and reraise a TypeError.\n    raise TypeError('Unsupported callable.')\n\n  args = []\n  varargs = None\n  varkw = None\n  kwonlyargs = []\n  defaults = ()\n  annotations = {}\n  defaults = ()\n  kwdefaults = {}\n\n  if sig.return_annotation is not sig.empty:\n    annotations['return'] = sig.return_annotation\n\n  for param in sig.parameters.values():\n    kind = param.kind\n    name = param.name\n\n    # pylint: disable=protected-access","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/google/python-fire/blob/716bbc23d7eca949fdb682172283c8d18f742cb6/fire/inspectutils.py#L94-L130","documentation":"GetFullArgSpec first tries inspect.signature on the callable; if that fails for any reason (ValueError for builtins/C extensions, AttributeError, exotic callables), Fire's Py3GetFullArgSpec re-raises TypeError('Unsupported callable.'). Fire cannot determine the argument spec needed for flag parsing.","triggerScenarios":"Firing a C builtin (e.g. fire.Fire(len) on some builds, fire.Fire(print) variants), ctypes functions, certain functools.partial/wrapper chains, or objects whose __call__ is unintrospectable.","commonSituations":"Exposing builtins or C extension functions as Fire commands; wrapping commands with non-standard decorators that hide the signature; platform version differences where signature support changed.","solutions":["Wrap the callable in a plain Python function with an explicit signature and fire that instead","Use functools.wraps on decorators so __wrapped__/signature is preserved","Fire a class or method defined in Python rather than the raw builtin","Catch TypeError and fall back to a manual dispatcher"],"exampleFix":"// before\nfire.Fire(os.stat)  # or another builtin / C function\n// after\ndef stat_safe(path):\n    return os.stat(path)\nfire.Fire(stat_safe)","handlingStrategy":"fallback","validationCode":"try:\n    inspect.signature(fn)\nexcept (TypeError, ValueError):\n    raise TypeError(f'{fn!r} is not introspectable; wrap it in a Python function')","typeGuard":"def is_introspectable(fn) -> bool:\n    try:\n        inspect.signature(fn)\n        return True\n    except (TypeError, ValueError):\n        return False","tryCatchPattern":"try:\n    fire.Fire(fn)\nexcept TypeError as e:\n    if 'Unsupported callable' in str(e):\n        fire.Fire(wrap_plain(fn))\n    else:\n        raise","preventionTips":["Wrap builtins/C-extension functions in plain Python functions","Use functools.wraps on all decorators","Check introspectability in tests for every command exposed to Fire"],"tags":["python","introspection","callable","signature"],"backgroundTag":"unsupported-callable","analyzedSha":"716bbc23d7eca949fdb682172283c8d18f742cb6","analyzedAt":"2026-08-28T21:57:47.200Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}