sourcegraph/src-cli

Improve hints on GitHub/GitLab access token related errors

Closed this issue · 0 comments

Recently a customer carried out the following steps:

  1. Created a personal access token under their Sourcegraph user settings.
  2. 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:

  1. If the -github-token argument is missing; explicitly recommend passing a -github-token argument.
  2. If the -github-token argument is present; provide a hint that the token may have either expired or doesn't have the public_repo access scope.

(Similarly for GitLab.)

Context: Slack thread 1, Slack thread 2