HKUDS/nanobot · error · OpenAICodexOAuthInputError

The callback URL is invalid. Copy the full URL from your…

Error message

The callback URL is invalid. Copy the full URL from your browser's address bar.

What it means

Raised by _validate_callback_url when the pasted URL cannot be parsed (urlsplit raises ValueError, typically from an invalid port). This is an input-validation guard meaning the string is not a well-formed URL.

Solutions

  1. Copy the full URL directly from the browser's address bar instead of retyping it
  2. Remove typos or stray characters (especially in the port) before pasting
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at nanobot/providers/openai_codex_oauth.py:219 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/61b107861072da0d. Report an issue: GitHub.

Appendix: source

Thrown at nanobot/providers/openai_codex_oauth.py:219


def complete_openai_codex_oauth_login(
    flow: OpenAICodexOAuthLoginFlow,
    callback_url: str | None = None,
) -> OAuthToken | None:
    """Complete a pending Codex login from a full callback URL."""
    return flow.complete(callback_url)


def _validate_callback_url(raw: str) -> tuple[str, bool]:
    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:

View on GitHub (pinned to 42f37dc4c0)