langchain-ai/langgraph · error · ValueError
Got unexpected type for `prompt
Error message
Got unexpected type for `prompt`: {type} What it means
Raised by create_react_agent when the prompt argument is none of the accepted types (str, SystemMessage, sequence of messages, callable, coroutine function, Runnable). The agent cannot interpret the value as a prompt. Pass a supported prompt type.
Solutions
- Pass a system prompt string, a callable taking state, an async function, or a langchain Runnable
- Wrap unsupported prompt objects in a lambda or RunnableLambda
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py:168 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of langchain-ai/langgraph@38031739e5 (2026-08-26).
Data as JSON: /api/errors/1f9fd09548a59f9e.
Report an issue: GitHub.
Appendix: source
Thrown at libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py:168
prompt_runnable = RunnableCallable(
lambda state: [prompt] + _get_state_value(state, "messages"),
name=PROMPT_RUNNABLE_NAME,
)
elif inspect.iscoroutinefunction(prompt):
prompt_runnable = RunnableCallable(
None,
prompt,
name=PROMPT_RUNNABLE_NAME,
)
elif callable(prompt):
prompt_runnable = RunnableCallable(
prompt,
name=PROMPT_RUNNABLE_NAME,
)
elif isinstance(prompt, Runnable):
prompt_runnable = prompt
else:
raise ValueError(f"Got unexpected type for `prompt`: {type(prompt)}")
return prompt_runnable
def _should_bind_tools(
model: LanguageModelLike, tools: Sequence[BaseTool], num_builtin: int = 0
) -> bool:
if isinstance(model, RunnableSequence):
model = next(
(
step
for step in model.steps
if isinstance(step, (RunnableBinding, BaseChatModel))
),
model,
)
if not isinstance(model, RunnableBinding):View on GitHub (pinned to 38031739e5)