Skip to content

Connection timeout is incorrectly reported as invalid token #8293

@tekumara

Description

@tekumara

Describe the bug

Connect timeout is incorrectly reported as invalid token

Steps to reproduce the behavior

  1. Authenticate to a GHE host (eg: ghe.mycorp.org) on the VPN, then disconnect from the VPN
  2. Note that the connection now times out, eg:
    ❯ curl --connect-timeout 5 https://ghe.mycorp.org
    curl: (28) Failed to connect to ghe.mycorp.org port 443 after 2005 ms: Timeout was reached
    
  3. Check auth status, eg:
    ❯ gh auth status -h ghe.mycorp.org
    ghe.mycorp.org
      X ghe.mycorp.org: authentication failed
      - The ghe.mycorp.org token in keyring is invalid.
      - To re-authenticate, run: gh auth login -h ghe.mycorp.org
      - To forget about this host, run: gh auth logout -h ghe.mycorp.org    
    

Expected vs actual behavior

Connection timeouts should be reported as connection timeout rather than an invalid token. An invalid token suggests reauthentication is required, when the solution is to resolve the connection timeout (eg: by connecting to the VPN).

Logs

❯ gh --version
gh version 2.38.0 (2023-11-01)
https://github.com/cli/cli/releases/tag/v2.38.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggh-authrelating to the gh auth commandhelp wantedContributions welcomep3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions