spec-kit icon indicating copy to clipboard operation
spec-kit copied to clipboard

The `uvx ... spec init` command fails with github release listing

Open gordonwatts opened this issue 1 year ago • 11 comments

The command:

uvx --from git+https://github.com/github/spec-kit.git specify init test_spec

I select copilot and PS (bash gives same error), and I get:

╭─────────────────────────────────╮
│ Specify Project Setup           │
│ Creating new project: test_spec │
╰─────────────────────────────────╯


Selected AI assistant: copilot
Selected script type: sh
Error fetching release information
╭──────────────────────────────────────────────────── Fetch Error ─────────────────────────────────────────────────────╮
│ GitHub API returned 401 for https://api.github.com/repos/github/spec-kit/releases/latest                             │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭────────────────────────────────────────────────────── Failure ───────────────────────────────────────────────────────╮
│ Initialization failed: 1                                                                                             │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

gordonwatts avatar Sep 20 '25 06:09 gordonwatts

Ok - more weird. When I clone it, and uv venv and uv pip install, it works.

gordonwatts avatar Sep 20 '25 06:09 gordonwatts

Can't repro on my local boxes. @gordonwatts - can you capture network logs and see what's going out and with what headers? I will work on tweaking the CLI tooling to make sure that the debug flag explicitly includes some GitHub asset acquisition diagnostics.

localden avatar Sep 20 '25 07:09 localden

My temporary workaround is to unset env GH_TOKEN and GITHUB_TOKEN. Those are added to the request in init even if they are not needed, in my case at least.

Here https://github.com/github/spec-kit/blob/5659c869b53261b418f011c1ccaf1b86f5aa399e/src/specify_cli/init.py#L56

I'm not sure why the GH_TOKEN or GITHUB_TOKEN is needed at all here @localden ?

A bit strange that it started to behave like this now.

simongartz avatar Sep 20 '25 07:09 simongartz

Ah - that is the problem - if I unset GITHUB_TOKEN then it works using uvx - no idea why it works, however, when I run from a download and setup env (where GITHUB_TOKEN is still being set.

gordonwatts avatar Sep 20 '25 08:09 gordonwatts

Latest release should fix it @gordonwatts - please try it out.

localden avatar Sep 20 '25 15:09 localden

@simongartz we're using the GitHub API to download the releases - sometimes you might run into issues where anonymous calls are not possible, so you have the option of using your own GitHub token to download them.

localden avatar Sep 20 '25 15:09 localden

Hi @localden, thank you for the quick fix on the token issue!

Thinking about the reliance on the GitHub API call, it brought up a broader architectural question for me. I noticed the init command needs to fetch releases online. This could be a challenge in certain environments.

Have you considered supporting use cases where a network connection isn't available or reliable? For example:

- Air-gapped systems: In secure corporate or government environments.

- Offline development: Working on a laptop with no Wi-Fi.

- Network instability: When GitHub is having an outage.

A workflow that doesn't require an active internet connection for project initialization would greatly increase the tool's robustness and could be critical for its adoption in some organizations.

Perhaps the tool could use a cached version of the spec, or allow a user to point to a local directory instead of fetching from GitHub?

Thanks for your work on this project!

m-da-costa avatar Sep 23 '25 15:09 m-da-costa

I wanted to add a comment to this closed issue so that if someone else runs into this issue like I did over the weekend might find a way to use Specify.

In the README, in the 🔧 Specify CLI Reference there is a reference to the optional argument --github-token.

Just add the argument and your token to the end of your specify init command it you avoid the 401 issue.

specify init YOUR-PROJECT-NAME --github-token=YOUR-GITHUB-TOKEN

lew-at-cs avatar Sep 29 '25 13:09 lew-at-cs

https://github.com/settings/personal-access-tokens generate token uvx --from git+https://github.com/github/spec-kit.git specify init . --github-token=xxxxxxxxxx can solve this problem

xuhan-rgb avatar Oct 01 '25 02:10 xuhan-rgb

Had this happen again to me today and can confirm that this in fact works:

specify init . --github-token " "

raneyeden avatar Jan 22 '26 00:01 raneyeden