Improve hints on GitHub/GitLab access token related errors
Created by: varungandhi-src
Recently a customer carried out the following steps:
- Created a personal access token under their Sourcegraph user settings.
- Called
src lsif upload
with the SRC_ACCESS_TOKEN value based on that when calling src-cli.
They got an error: (as they wrote in the email)
❌ Failed to upload index file
unauthorized upload
You may need to specify or update your GitHub access token to use this endpoint.
Based on the code, it looks like they must've also got a hint pointing to https://docs.sourcegraph.com/cli/references/lsif/upload (which is great!) but it looks they weren't able to figure out a solution by reading the docs (or they didn't read the docs).
Perhaps we should:
- If the
-github-token
argument is missing; explicitly recommend passing a-github-token
argument. - If the
-github-token
argument is present; provide a hint that the token may have either expired or doesn't have thepublic_repo
access scope.
(Similarly for GitLab.)
Context: Slack thread 1, Slack thread 2