HKUDS/nanobot · error · OpenAICodexOAuthInputError

Paste the full callback URL from your browser

Error message

Paste the full callback URL from your browser ({OPENAI_CODEX_PROVIDER.redirect_uri}?...).

What it means

Raised by _validate_callback_url when the URL parses but does not match the expected OAuth redirect URI: wrong scheme, host not in _CALLBACK_HOSTS, wrong port, wrong path, or embedded credentials. The pasted string is not this flow's callback URL.

Solutions

  1. Copy the complete URL the browser was redirected to (localhost:<port>/auth/... shape matching OPENAI_CODEX_PROVIDER.redirect_uri)
  2. Make sure the URL is the redirect after sign-in, not the authorization page URL
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at nanobot/providers/openai_codex_oauth.py:230 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of HKUDS/nanobot@42f37dc4c0 (2026-08-26). Data as JSON: /api/errors/3fec04322d658ff3. Report an issue: GitHub.

Appendix: source

Thrown at nanobot/providers/openai_codex_oauth.py:230

    value = raw.strip()
    if not value:
        raise OpenAICodexOAuthInputError("Paste the full callback URL from your browser.")
    try:
        parsed = urlsplit(value)
        port = parsed.port
    except ValueError as exc:
        raise OpenAICodexOAuthInputError(
            "The callback URL is invalid. Copy the full URL from your browser's address bar."
        ) from exc
    if (
        parsed.scheme != _CALLBACK.scheme
        or parsed.hostname not in _CALLBACK_HOSTS
        or port != _CALLBACK.port
        or parsed.path != _CALLBACK.path
        or parsed.username is not None
        or parsed.password is not None
    ):
        raise OpenAICodexOAuthInputError(
            f"Paste the full callback URL from your browser ({OPENAI_CODEX_PROVIDER.redirect_uri}?...)."
        )
    params = parse_qs(parsed.query)
    code = _first(params, "code")
    state = _first(params, "state")
    error = _first(params, "error")
    if not state:
        raise OpenAICodexOAuthInputError(
            "The callback URL is missing OAuth state. Copy the entire browser address."
        )
    if not code and not error:
        raise OpenAICodexOAuthInputError(
            "The callback URL has no authorization result. Finish signing in, then copy it again."
        )
    return state, error is not None


def _safe_login_error(exc: Exception) -> OpenAICodexOAuthError:

View on GitHub (pinned to 42f37dc4c0)