{"record":{"id":"67f6845410dce169","repo":"langchain-ai/deepagents","slug":"ask-user-failed-internally-after-its-arguments-wer","errorCode":null,"errorMessage":"ask_user failed internally after its arguments were validated; this is not a model-authored error","messagePattern":"ask_user failed internally after its arguments were validated; this is not a model-authored error","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/ask_user.py","lineNumber":452,"sourceCode":"                    response,\n                    questions,\n                    tool_call_id,\n                    thread_id=(\n                        execution_thread_id\n                        if execution_thread_id == context_thread_id\n                        and runtime_tool_call_id == tool_call_id\n                        else None\n                    ),\n                    turn_id=(\n                        context_turn_id if context_turn_id == active_turn_id else None\n                    ),\n                )\n            except ValidationError as exc:\n                msg = (\n                    \"ask_user failed internally after its arguments were \"\n                    \"validated; this is not a model-authored error\"\n                )\n                raise RuntimeError(msg) from exc\n\n        _ask_user.name = \"ask_user\"\n        self.tools = [_ask_user]\n\n    @override\n    def wrap_tool_call(\n        self,\n        request: ToolCallRequest,\n        handler: Callable[[ToolCallRequest], ToolMessage | Command[Any]],\n    ) -> ToolMessage | Command[Any]:\n        \"\"\"Log a rejected `ask_user` call, then pass the result through.\n\n        `ToolNode` converts an argument `ValidationError` into an error\n        `ToolMessage` before it reaches here, and it logs nothing itself, so\n        without this a model sending malformed arguments — or looping on them —\n        leaves no operator-visible record at all. The user sees only a red\n        `ask_user` row in the transcript.\n","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/ask_user.py#L434-L470","documentation":"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.","triggerScenarios":"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.","commonSituations":"Upgrading langchain/deepagents versions so the tool-call schema drifts from the internal validator; custom subclasses overriding ask_user argument models incorrectly.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    result = await ask_user_tool.ainvoke(args)\nexcept RuntimeError as exc:\n    if \"not a model-authored error\" in str(exc):\n        logger.exception(\"ask_user internal failure — file a bug with the arguments\")\n        raise\n    raise","preventionTips":["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"],"tags":["internal-error","pydantic","tool-schema"],"backgroundTag":"internal-validation-failure","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}