The `uvx ... spec init` command fails with github release listing
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 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Ok - more weird. When I clone it, and uv venv and uv pip install, it works.
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.
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.
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.
Latest release should fix it @gordonwatts - please try it out.
@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.
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!
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
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
Had this happen again to me today and can confirm that this in fact works:
specify init . --github-token " "