langchain-ai/deepagents · error · RuntimeError
No callback URL received (stdin closed). Re-run `dcode mcp l
Error message
No callback URL received (stdin closed). Re-run `dcode mcp login <server>` and paste the URL.
What it means
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.
Source
Thrown at libs/code/deepagents_code/mcp_oauth_ui.py:146
async def request_callback_url(self) -> str: # noqa: PLR6301
"""Read a trimmed callback URL from stdin via a worker thread.
Returns:
The trimmed callback URL string.
Raises:
RuntimeError: If stdin is closed before the user replies.
"""
import asyncio
try:
raw = await asyncio.to_thread(input, "Callback URL: ")
except EOFError as exc:
msg = (
"No callback URL received (stdin closed). "
"Re-run `dcode mcp login <server>` and paste the URL."
)
raise RuntimeError(msg) from exc
return raw.strip()
async def show_device_code( # noqa: PLR6301
self,
*,
verification_uri: str,
user_code: str,
expires_in: int,
) -> None:
"""Print RFC 8628 device-code instructions to stdout."""
print( # noqa: T201
f"\nVisit {verification_uri} and enter code: "
f"{user_code}\n(code expires in {expires_in}s)\n",
)
async def prompt_slack_team_id(self) -> str | None: # noqa: PLR6301
"""Ask for a Slack team ID via `input()` on a worker thread.
View on GitHub (pinned to a1af029e6e)
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).
Example fix
// before (CI script) dcode mcp login github // after docker run -it ... dcode mcp login github # or: echo "$CALLBACK_URL" | dcode mcp login github
Defensive patterns
Strategy: try-catch
Validate before calling
import sys
if sys.stdin is None or sys.stdin.isatty() is False:
print("warning: no interactive stdin; callback URL prompt will fail") Try / catch
try:
url = await ui.request_callback_url()
except RuntimeError as exc:
if "stdin closed" in str(exc):
print("Run interactively or pipe the callback URL: echo $URL | dcode mcp login <server>")
else:
raise Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- MCPReauthRequiredError({server_name})
- Authorization denied by provider: {err_code}{detail}
- Callback URL is missing the 'code' parameter.
- Device code request failed: HTTP {response.status_code} from
- Device code response from {device_code_url} is missing requi
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/08930078eb0f8b58.
Report an issue: GitHub.