HKUDS/nanobot · error · OpenAICodexOAuthInputError

The callback URL does not belong to this sign-in flow. Copy…

Error message

The callback URL does not belong to this sign-in flow. Copy the latest URL.

What it means

Raised in OpenAICodexOAuthLoginFlow.complete when the pasted callback URL's state parameter does not match the state expected by the current sign-in flow (validated by _validate_callback_url against _expected_state). The URL belongs to an older or different sign-in attempt.

Solutions

  1. Restart the sign-in flow and copy the callback URL from the most recent authorization page
  2. Ensure only one sign-in flow is active at a time
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

Thrown at nanobot/providers/openai_codex_oauth.py:106

        self._fail(error)
        raise error

    def complete(self, callback_url: str | None = None) -> OAuthToken | None:
        """Submit a full callback URL, or return ``None`` while waiting for one."""
        if self._result.done():
            return self._result.result()
        if self.expired:
            error = OpenAICodexOAuthError(
                "OpenAI Codex sign-in expired. Start a new sign-in flow."
            )
            self._fail(error)
            raise error
        if callback_url is None:
            return None

        callback_state, authorization_failed = _validate_callback_url(callback_url)
        if not hmac.compare_digest(callback_state, self._expected_state):
            raise OpenAICodexOAuthInputError(
                "The callback URL does not belong to this sign-in flow. Copy the latest URL."
            )
        if authorization_failed:
            error = OpenAICodexOAuthError(
                "OpenAI Codex sign-in was not completed by the authorization server."
            )
            self._fail(error)
            raise error

        with self._submission_lock:
            if self._submitted:
                return None
            self._submitted = True
            try:
                self._callback_input.put_nowait(callback_url.strip())
            except queue.Full:
                return None
        return self._result.result() if self._result.done() else None

View on GitHub (pinned to 42f37dc4c0)