{"record":{"id":"0dca49789a3ffd96","repo":"langchain-ai/langchain","slug":"runnable-self-get-name-doesn-t-have-an-inferab-0dca49","errorCode":null,"errorMessage":"Runnable {self.get_name()} doesn't have an inferable OutputType. Override the OutputType property to specify the output type.","messagePattern":"Runnable (.+?) doesn't have an inferable OutputType\\. Override the OutputType property to specify the output type\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"libs/core/langchain_core/runnables/base.py","lineNumber":372,"sourceCode":"        for base in self.__class__.mro():\n            if hasattr(base, \"__pydantic_generic_metadata__\"):\n                metadata = base.__pydantic_generic_metadata__\n                if (\n                    \"args\" in metadata\n                    and len(metadata[\"args\"]) == _RUNNABLE_GENERIC_NUM_ARGS\n                ):\n                    return cast(\"type[Output]\", metadata[\"args\"][1])\n\n        for cls in self.__class__.__orig_bases__:  # type: ignore[attr-defined]\n            type_args = get_args(cls)\n            if type_args and len(type_args) == _RUNNABLE_GENERIC_NUM_ARGS:\n                return cast(\"type[Output]\", type_args[1])\n\n        msg = (\n            f\"Runnable {self.get_name()} doesn't have an inferable OutputType. \"\n            \"Override the OutputType property to specify the output type.\"\n        )\n        raise TypeError(msg)\n\n    @property\n    def input_schema(self) -> TypeBaseModel:\n        \"\"\"The type of input this `Runnable` accepts specified as a Pydantic model.\"\"\"\n        return self.get_input_schema()\n\n    def get_input_schema(\n        self,\n        config: RunnableConfig | None = None,\n    ) -> TypeBaseModel:\n        \"\"\"Get a Pydantic model that can be used to validate input to the `Runnable`.\n\n        `Runnable` objects that leverage the `configurable_fields` and\n        `configurable_alternatives` methods will have a dynamic input schema that\n        depends on which configuration the `Runnable` is invoked with.\n\n        This method allows to get an input schema for a specific configuration.\n","sourceCodeStart":354,"sourceCodeEnd":390,"githubUrl":"https://github.com/langchain-ai/langchain/blob/e32fa9a52eab3b61ad7a45399bfde59b3e580fc4/libs/core/langchain_core/runnables/base.py#L354-L390","documentation":"Raised by the `OutputType` property on `Runnable` when the output type cannot be inferred: the pydantic-model metadata scan finds no annotated args and no `__orig_bases__` entry is a parameterized `Runnable[Input, Output]` from which `type_args[1]` could be taken. Mirrors the `InputType` error but for the output side; the message names the Runnable and tells you to override `OutputType`.","triggerScenarios":"`class MyRunnable(Runnable):` with only `invoke` implemented, then accessing `.OutputType`, `.get_output_schema()`, or passing it to code that renders graphs / validates stream payloads. Also triggered when `Runnable[OneGeneric]` is used with fewer type args than required.","commonSituations":"Custom Runnables written without generic parameters being plugged into LangGraph nodes, LangSmith tracing, or `RunnableSequence` schema checks; third-party examples copied with the generics stripped for brevity.","solutions":["Parameterize the base: `class MyRunnable(Runnable[str, dict])`","Or override: `@property def OutputType(self): return dict`","Keep the parameterization even when it looks redundant — schema inference depends on it at runtime, not just for static checkers"],"exampleFix":"# before\nclass Extract(Runnable):\n    def invoke(self, text, config=None):\n        return {\"entities\": []}\nExtract().OutputType  # TypeError\n\n# after\nclass Extract(Runnable[str, dict]):\n    def invoke(self, text, config=None):\n        return {\"entities\": []}","handlingStrategy":"type-guard","validationCode":"def has_inferable_output_type(runnable: Runnable) -> bool:\n    try:\n        _ = runnable.OutputType\n        return True\n    except TypeError:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    schema = runnable.get_output_schema()\nexcept TypeError as e:\n    if \"inferable OutputType\" in str(e):\n        raise TypeError(f\"{type(runnable).__name__} must be Runnable[I, O] or override OutputType\") from e\n    raise","preventionTips":["Parameterize Runnable[Input, Output] on every custom class","Override OutputType explicitly when the output type is dynamic","Test schema introspection in unit tests for custom Runnables"],"tags":["runnables","lcel","type-inference","typeerror","custom-components"],"backgroundTag":null,"analyzedSha":"e32fa9a52eab3b61ad7a45399bfde59b3e580fc4","analyzedAt":"2026-08-14T18:42:09.092Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}