xtekky/gpt4free · warning · RuntimeError

No input provided

Error message

No input provided

What it means

In the manual fallback login path (no callback server), the interactive input() for the pasted redirect URL or authorization code came back empty after strip(). This is purely user-input validation inside the CLI login flow.

Source

Thrown at g4f/Provider/needs_auth/GeminiCLI.py:1250

                if tokens.get("email"):
                    print(f"  Logged in as: {tokens['email']}")

                return tokens

            finally:
                callback_server.stop()
        else:
            print(
                "\nAfter completing authentication, you'll be redirected to a localhost URL."
            )
            print(
                "Copy and paste the full redirect URL or just the authorization code below:\n"
            )

            user_input = input("Paste redirect URL or code: ").strip()

            if not user_input:
                raise RuntimeError("No input provided")

            if user_input.startswith("http"):
                parsed = urlparse(user_input)
                params = parse_qs(parsed.query)
                code = params.get("code", [None])[0]
                callback_state = params.get("state", [state])[0]
            else:
                code = user_input
                callback_state = state

            if not code:
                raise RuntimeError("Could not extract authorization code")

            print("\nExchanging code for tokens...")
            tokens = await cls.exchange_code_for_tokens(code, callback_state)

            print(f"✓ Authentication successful!")
            if tokens.get("email"):

View on GitHub (pinned to 973504e177)

Solutions

  1. Re-run login interactively and paste the full redirect URL or the raw code
  2. If stdin cannot be interactive, use the callback-server path or inject credentials via GCP_SERVICE_ACCOUNT directly
  3. Verify the paste actually landed before pressing Enter
Defensive patterns

Strategy: validation

Validate before calling

import sys

def read_login_input(prompt: str) -> str:
    if not sys.stdin.isatty():
        raise RuntimeError("login requires an interactive terminal")
    while True:
        value = input(prompt).strip()
        if value:
            return value
        print("empty input; paste the redirect URL or code")

Try / catch

try:
    tokens = await GeminiCLI.login()
except RuntimeError as e:
    if "No input provided" in str(e):
        raise SystemExit("run login in an interactive shell")

Prevention

When it happens

Trigger: Running GeminiCLI.login in the manual path and pressing Enter (or piping empty stdin) at the 'Paste redirect URL or code:' prompt.

Common situations: Login run in a non-interactive shell or CI where stdin is empty; user presses Enter too early; clipboard paste fails silently.

Related errors


AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14). Data as JSON: /api/errors/76b14d453427ac76. Report an issue: GitHub.