langchain-ai/deepagents · error · RuntimeError
ask_user failed internally after its arguments were validate
Error message
ask_user failed internally after its arguments were validated; this is not a model-authored error
What it means
Inside `ask_user`'s tool implementation, a pydantic `ValidationError` after arguments were already validated indicates an internal bug, not a model-authored mistake. To prevent the model from seeing and retrying its own malformed-looking input, it is converted to a RuntimeError with an explicit 'internal failure' message.
Source
Thrown at libs/code/deepagents_code/ask_user.py:452
response,
questions,
tool_call_id,
thread_id=(
execution_thread_id
if execution_thread_id == context_thread_id
and runtime_tool_call_id == tool_call_id
else None
),
turn_id=(
context_turn_id if context_turn_id == active_turn_id else None
),
)
except ValidationError as exc:
msg = (
"ask_user failed internally after its arguments were "
"validated; this is not a model-authored error"
)
raise RuntimeError(msg) from exc
_ask_user.name = "ask_user"
self.tools = [_ask_user]
@override
def wrap_tool_call(
self,
request: ToolCallRequest,
handler: Callable[[ToolCallRequest], ToolMessage | Command[Any]],
) -> ToolMessage | Command[Any]:
"""Log a rejected `ask_user` call, then pass the result through.
`ToolNode` converts an argument `ValidationError` into an error
`ToolMessage` before it reaches here, and it logs nothing itself, so
without this a model sending malformed arguments — or looping on them —
leaves no operator-visible record at all. The user sees only a red
`ask_user` row in the transcript.
View on GitHub (pinned to a1af029e6e)
Solutions
- Treat it as a bug: report/reproduce with the exact tool call arguments
- Check installed versions of deepagents-code and langchain for schema drift and align them
- Verify any custom ask_user subclass keeps its argument model consistent with the tool schema
Defensive patterns
Strategy: try-catch
Try / catch
try:
result = await ask_user_tool.ainvoke(args)
except RuntimeError as exc:
if "not a model-authored error" in str(exc):
logger.exception("ask_user internal failure — file a bug with the arguments")
raise
raise Prevention
- Keep deepagents-code and langchain versions aligned (schema drift causes this)
- Don't subclass ask_user with a mismatched argument model
- Treat this RuntimeError as a library bug, never a prompt problem
- Capture the exact tool-call arguments when reporting
When it happens
Trigger: The ask_user tool runs and its second-stage validation raises ValidationError — i.e. an inconsistency between the declared tool schema and the internal handler, or a framework version mismatch producing differently-shaped arguments.
Common situations: Upgrading langchain/deepagents versions so the tool-call schema drifts from the internal validator; custom subclasses overriding ask_user argument models incorrectly.
Related errors
- interpreter.enable_interpreter is missing from the config ma
- tool_call_id must not be empty
- deny decisions require a reason
- must contain non-whitespace text
- argv must be a non-empty list of strings when provided.
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/67f6845410dce169.
Report an issue: GitHub.