HKUDS/nanobot · error · OpenAICodexOAuthInputError

The callback URL has no authorization result. Finish…

Error message

The callback URL has no authorization result. Finish signing in, then copy it again.

What it means

Raised by _validate_callback_url when the URL has a state but carries neither an authorization `code` nor an `error` parameter — i.e. the query does not represent a completed OAuth authorization response. The user likely copied the URL before finishing sign-in.

Solutions

  1. Finish the sign-in in the browser, then copy the final redirect URL again
  2. If the provider returned an error page, capture and report its `error` parameter
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

Thrown at nanobot/providers/openai_codex_oauth.py:242

        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:
    if isinstance(exc, OpenAICodexOAuthError):
        return exc
    message = str(exc).strip()
    if message == "State validation failed.":
        return OpenAICodexOAuthError(
            "OpenAI Codex sign-in failed because the OAuth state did not match."
        )
    if message == "Authorization code not found.":
        return OpenAICodexOAuthError(
            "OpenAI Codex sign-in returned no authorization code."
        )
    status = _TOKEN_EXCHANGE_STATUS.search(message)

View on GitHub (pinned to 42f37dc4c0)