Skip to content

Better error message for expired/invalid PAT #17

Open

Description

@aeisenberg
$ gh codeql list-versions
expected an object but got: string ("https://docs.github.com/rest")

I haven't investigated, but perhaps this is making an invalid API request.


EDIT: The reason for the error was an expired PAT. Leaving this issue open so we can provide a better error message in this case.

Activity

  1. aeisenberg commented on Jan 25, 2022

    @aeisenberg
    ContributorAuthor

    Similar error with download.

    $ gh codeql  download 2.7.5
    expected an object but got: string ("https://docs.github.com/rest")
    ERROR: Version '2.7.5' not found.
    
  2. edoardopirovano commented on Jan 25, 2022

    @edoardopirovano
    Contributor

    Hmm, everything is working fine for me and I can't seem to reproduce this locally. There must be something in your local environment that is different to mine (perhaps a Mac version of one of the utilities we are using that is doing something different from the Linux one?). I'd be happy to debug this together if you want to put a call in my calendar whenever suits you 🙂

  3. aeisenberg commented on Jan 25, 2022

    @aeisenberg
    ContributorAuthor

    Interesting...let me play around a bit more. I'm using gh v2.4.0, which is the latest, so it's not that.

  4. edoardopirovano commented on Jan 25, 2022

    @edoardopirovano
    Contributor

    Incidentally, gh codeql download 2.7.5 does fail for me but with a different error (it wants gh codeql download v2.7.5 because the release tags have a v before them. I added some logic that automatically adds it when it's missing in set-version in #7 but apparently that logic isn't being used for download).

  5. aeisenberg commented on Jan 25, 2022

    @aeisenberg
    ContributorAuthor

    🤦🏼 Looks like my PAT expired:

    $ gh api repos/github/codeql-cli-binaries/releases
    gh: Bad credentials (HTTP 401)
    {
      "message": "Bad credentials",
      "documentation_url": "https://docs.github.com/rest"
    }
    
  6. edoardopirovano commented on Jan 25, 2022

    @edoardopirovano
    Contributor

    Aha, that would make sense. Still we could definitely recognise a 401 error and give the user a more informative error about renewing their PAT.

  7. aeisenberg commented on Jan 25, 2022

    @aeisenberg
    ContributorAuthor

    That would be nice. I got a message that it expired today, but completely forgot about it.

    I'll update the issue title.

  8. changed the title [-]List versions is giving an error[/-] [+]Better error message for expired/invalid PAT[/+] on Jan 25, 2022
  9. added
    enhancementNew feature or request
    and removed
    bugSomething isn't working
    on Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions