{"record":{"id":"08930078eb0f8b58","repo":"langchain-ai/deepagents","slug":"no-callback-url-received-stdin-closed-re-run-d","errorCode":null,"errorMessage":"No callback URL received (stdin closed). Re-run `dcode mcp login <server>` and paste the URL.","messagePattern":"No callback URL received \\(stdin closed\\)\\. Re-run `dcode mcp login <server>` and paste the URL\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/mcp_oauth_ui.py","lineNumber":146,"sourceCode":"    async def request_callback_url(self) -> str:  # noqa: PLR6301\n        \"\"\"Read a trimmed callback URL from stdin via a worker thread.\n\n        Returns:\n            The trimmed callback URL string.\n\n        Raises:\n            RuntimeError: If stdin is closed before the user replies.\n        \"\"\"\n        import asyncio\n\n        try:\n            raw = await asyncio.to_thread(input, \"Callback URL: \")\n        except EOFError as exc:\n            msg = (\n                \"No callback URL received (stdin closed). \"\n                \"Re-run `dcode mcp login <server>` and paste the URL.\"\n            )\n            raise RuntimeError(msg) from exc\n        return raw.strip()\n\n    async def show_device_code(  # noqa: PLR6301\n        self,\n        *,\n        verification_uri: str,\n        user_code: str,\n        expires_in: int,\n    ) -> None:\n        \"\"\"Print RFC 8628 device-code instructions to stdout.\"\"\"\n        print(  # noqa: T201\n            f\"\\nVisit {verification_uri} and enter code: \"\n            f\"{user_code}\\n(code expires in {expires_in}s)\\n\",\n        )\n\n    async def prompt_slack_team_id(self) -> str | None:  # noqa: PLR6301\n        \"\"\"Ask for a Slack team ID via `input()` on a worker thread.\n","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/mcp_oauth_ui.py#L128-L164","documentation":"During OAuth device/authorization-code login, request_callback_url prompts the user on stdin to paste the provider's callback URL. If stdin hits EOF (closed or non-interactive), the library raises this RuntimeError because the OAuth flow cannot complete without the callback URL.","triggerScenarios":"Running `dcode mcp login <server>` with stdin closed or redirected from /dev/null, in CI/non-interactive shells, or after piping input that ends before a URL is supplied.","commonSituations":"Running the login inside Docker/CI without `-it`; wrapping dcode in a script that consumed stdin; forgetting to allocate a TTY over SSH or in automation.","solutions":["Re-run `dcode mcp login <server>` in an interactive terminal and paste the callback URL when prompted.","In Docker/CI, allocate a TTY (`docker run -it`) or pipe the callback URL into stdin: `echo \"$URL\" | dcode mcp login <server>`.","If automation is required, use a flow that does not need a pasted callback (e.g. device-code flow with a verification URI, or pre-provisioned credentials)."],"exampleFix":"// before (CI script)\ndcode mcp login github\n// after\ndocker run -it ... dcode mcp login github   # or: echo \"$CALLBACK_URL\" | dcode mcp login github","handlingStrategy":"try-catch","validationCode":"import sys\nif sys.stdin is None or sys.stdin.isatty() is False:\n    print(\"warning: no interactive stdin; callback URL prompt will fail\")","typeGuard":null,"tryCatchPattern":"try:\n    url = await ui.request_callback_url()\nexcept RuntimeError as exc:\n    if \"stdin closed\" in str(exc):\n        print(\"Run interactively or pipe the callback URL: echo $URL | dcode mcp login <server>\")\n    else:\n        raise","preventionTips":["Run OAuth login in an interactive terminal (TTY/`docker run -it`)","Don't redirect stdin from /dev/null for login commands","In automation, use device-code flow or pre-provisioned credentials instead"],"tags":["mcp","oauth","stdin","interactive"],"backgroundTag":"stdin-closed","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}