Stack error [S-8332]: unable to download the index of available snapshots

Hi, I’m trying to use stack new to set up a project with a template yesodweb/minimal. I’m using the stack version: Version 3.1.1 x86_64.

When I run stack new testing-minimal yesodweb/minimal, I get the following messages:

Downloading template yesodweb/minimal to create project testing-minimal in directory testing-minimal/...
Downloaded /HOME/.stack/templates/yesodweb/minimal.hsfiles.               
Looking for Cabal or package.yaml files to use to initialise Stack's project-level YAML configuration file.

Using the Cabal packages:
* testing-minimal/

After hanging for a bit, I get the following error message:

Error: [S-8332]
       Stack failed to create project-level YAML configuration, as it was unable to download the index of available snapshots.
       
       This sometimes happens because Certificate Authorities are missing on your system. You can try the Stack command again or manually create the configuration file. For
       help about the content of Stack's YAML configuration files, see (for the most recent release of Stack) http://docs.haskellstack.org/en/stable/yaml_configuration/.
       
       While downloading the snapshot index, Stack encountered the following error:
       
       HttpExceptionRequest Request {
         host                 = "stackage-haddock.haskell.org"
         port                 = 443
         secure               = True
         requestHeaders       = [("Accept","application/json"),("User-Agent","The Haskell Stack")]
         path                 = "/snapshots.json"
         queryString          = ""
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
         proxySecureMode      = ProxySecureWithConnect
       }
        ConnectionTimeout

Following advice from the configuration files page for stack, I have the following lines in my .stack/config.yaml file:

urls:
  latest-snapshot: https://stackage-haddock.haskell.org/snapshots.json

But that has not fixed the problem. Does anyone have any ideas what might be behind this problem?

Can you open https://stackage-haddock.haskell.org/snapshots.json in a browser? Or does it time out as well?

It opens just fine, with no real delay.

OK. Does curl https://stackage-haddock.haskell.org/snapshots.json work in the same terminal window in which you are running stack?

Curl works just fine, and is very quick.

ping stack-haddock.haskell.org does not work, but that may just be because the server blocks ICMP requests.

I have been experiencing this same problem on my Windows 11 laptop (only, not my main Windows 11 PC) relatively recently. I’ve not yet identified the cause. My current work around is to re-boot my laptop - it then works fine (for a while).

I’m getting this error with stack Version 3.3.1, Git revision 62d1bdf099c8c30634208f76cb4444f9896e4336 x86_64 hpack-0.37.0 installed by a fresh GHCup install. Web browser and curl in the same shell both work fine.

1 Like

@eisnerd thanks for the report. How consistently do you see this problem? I can’t reproduce it right now.

1 Like

Every time. It’s not worked once. Ubuntu 22.04.5 LTS, no proxy.

Thanks for checking it out and replying.

1 Like

Hmm. Pinging @mpilgrem as well. Can you post the exact error messages you’re getting? Can you also post the output of curl -i https://stackage-haddock.haskell.org/snapshots.json? It will “leak” your rough global location by showing which Cloudflare datacenter responded to the request. Here’s mine:

$ curl -i https://stackage-haddock.haskell.org/snapshots.json
HTTP/2 200
date: Fri, 16 May 2025 14:34:12 GMT
content-type: application/json
content-length: 532
accept-ranges: bytes
etag: "02e6eff387bd0668a28505743b711b70"
last-modified: Fri, 16 May 2025 14:24:03 GMT
vary: Accept-Encoding
cf-cache-status: DYNAMIC
server: cloudflare
cf-ray: 940b9832fb914e12-HEL

{"lts":"lts-23.22","lts-0":"lts-0.7","lts-1":"lts-1.15","lts-10":"lts-10.10","lts-11":"lts-11.22","lts-12":"lts-12.26","lts-13":"lts-13.30","lts-14":"lts-14.27","lts-15":"lts-15.16","lts-16":"lts-16.31","lts-17":"lts-17.15","lts-18":"lts-18.28","lts-19":"lts-19.33","lts-2":"lts-2.22","lts-20":"lts-20.26","lts-21":"lts-21.25","lts-22":"lts-22.44","lts-23":"lts-23.22","lts-3":"lts-3.22","lts-4":"lts-4.2","lts-5":"lts-5.18","lts-6":"lts-6.35","lts-7":"lts-7.24","lts-8":"lts-8.24","lts-9":"lts-9.21","nightly":"nightly-2025-05-16"}
1 Like

Sorry about the delay, and I appreciate the privacy related warning.

$ stack new test
Downloading template new-template to create project test in directory test/...
Downloaded /home/eisd/.stack/templates/new-template.hsfiles.               
Looking for Cabal or package.yaml files to use to initialise Stack's project-level YAML configuration file.

Using the Cabal packages:
* test/


Error: [S-8332]
       Stack failed to create project-level configuration file, as it was unable to download the index of available snapshots.
       
       This sometimes happens because Certificate Authorities are missing on your system. You can try the Stack command again or manually
       create the configuration file. For help about the content of Stack's configuration files, see (for the most recent release of Stack)
       http://docs.haskellstack.org/en/stable/configure/yaml/.
       
       While downloading the snapshot index, Stack encountered the following error:
       
       HttpExceptionRequest Request {
         host                 = "stackage-haddock.haskell.org"
         port                 = 443
         secure               = True
         requestHeaders       = [("Accept","application/json"),("User-Agent","The Haskell Stack")]
         path                 = "/snapshots.json"
         queryString          = ""
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
         proxySecureMode      = ProxySecureWithConnect
       }
        ConnectionTimeout


$ curl -i https://stackage-haddock.haskell.org/snapshots.json
HTTP/2 200 
date: Fri, 16 May 2025 17:59:20 GMT
content-type: application/json
content-length: 532
accept-ranges: bytes
etag: "02e6eff387bd0668a28505743b711b70"
last-modified: Fri, 16 May 2025 17:58:57 GMT
vary: Accept-Encoding
cf-cache-status: DYNAMIC
server: cloudflare
cf-ray: 940cc4b05808511d-LHR

{"lts":"lts-23.22","lts-0":"lts-0.7","lts-1":"lts-1.15","lts-10":"lts-10.10","lts-11":"lts-11.22","lts-12":"lts-12.26","lts-13":"lts-13.30","lts-14":"lts-14.27","lts-15":"lts-15.16","lts-16":"lts-16.31","lts-17":"lts-17.15","lts-18":"lts-18.28","lts-19":"lts-19.33","lts-2":"lts-2.22","lts-20":"lts-20.26","lts-21":"lts-21.25","lts-22":"lts-22.44","lts-23":"lts-23.22","lts-3":"lts-3.22","lts-4":"lts-4.2","lts-5":"lts-5.18","lts-6":"lts-6.35","lts-7":"lts-7.24","lts-8":"lts-8.24","lts-9":"lts-9.21","nightly":"nightly-2025-05-16"}
1 Like

Since you can reliably reproduce this with stack, but it seems to be due to something distinctive about your environment, can you open a ticket at Stack issues ? I still can’t reproduce (even with stack init), and I believe the resource itself is in good shape.

1 Like

Will do. Thanks for your help.

1 Like

It is currently playing up for me in the same way on my Windows 11 Home (24H2) laptop in Windows Terminal (Version: 1.22.11141.0) (started playing up again yesterday evening, as I recall). My ‘fix’ is to reboot.

Stack itself just makes use of the ‘standard’ libraries, and in a straightforward way, so, if the problem is Haskell-related, it is somewhere in the dependencies. However, I can’t say it is Haskell-related.

Looking at my update history, I see two security updates and one cumulative update were installed on 14 May. Coincidence? I don’t know.

Searching for parts of the error message rather than the stack new command brought up this: Connection Failure error with hackage.haskell.org · Issue #5994 · commercialhaskell/stack · GitHub

There’s a workaround for me and at least a few others of disabling IPv6, which for me is nmcli connection modify MyNetworkName ipv6.method disabled. In fact, it still works, at least temporarily, after re-enabling, which I’m guessing is to do with caching of DHCP or routes in some way. I wouldn’t be surprised if it stopped working after a reboot or some time.