Cabal update fails with an HTTP 416?!

I’m trying to do cabal update, but I’m getting this weird error the whole past hour:

❯ cabal update -v
Project settings changed, reconfiguring...
Downloading the latest package list from hackage.haskell.org
Warning: The package list for 'hackage.haskell.org' is 18 days old.
Run 'cabal update' to get the latest list of available packages.
Selected mirror http://hackage.haskell.org/
Downloading timestamp
Running: /run/current-system/sw/bin/curl 'http://hackage.haskell.org/timestamp.json' --output /tmp/transportAdapterGet951942-1 --location --write-out '%{http_code}' --user-agent 'cabal-install/3.10.3.0 (linux; x86_64)' --silent --show-error --dump-header /tmp/curl-headers951942-2.txt
Downloading snapshot
Running: /run/current-system/sw/bin/curl 'http://hackage.haskell.org/snapshot.json' --output /tmp/transportAdapterGet951942-4 --location --write-out '%{http_code}' --user-agent 'cabal-install/3.10.3.0 (linux; x86_64)' --silent --show-error --dump-header /tmp/curl-headers951942-5.txt
Updating index
Running: /run/current-system/sw/bin/curl 'http://hackage.haskell.org/01-index.tar.gz' --output /tmp/transportAdapterGet951942-7 --location --write-out '%{http_code}' --user-agent 'cabal-install/3.10.3.0 (linux; x86_64)' --silent --show-error --dump-header /tmp/curl-headers951942-8.txt --header 'Range: bytes=122536125-122978166'
Exception Unexpected response 416 for
http://hackage.haskell.org/01-index.tar.gz when using mirror
http://hackage.haskell.org/
Selected mirror http://hackage.fpcomplete.com/
Downloading timestamp
Running: /run/current-system/sw/bin/curl 'http://hackage.fpcomplete.com/timestamp.json' --output /tmp/transportAdapterGet951942-10 --location --write-out '%{http_code}' --user-agent 'cabal-install/3.10.3.0 (linux; x86_64)' --silent --show-error --dump-header /tmp/curl-headers951942-11.txt
Downloading snapshot
Running: /run/current-system/sw/bin/curl 'http://hackage.fpcomplete.com/snapshot.json' --output /tmp/transportAdapterGet951942-13 --location --write-out '%{http_code}' --user-agent 'cabal-install/3.10.3.0 (linux; x86_64)' --silent --show-error --dump-header /tmp/curl-headers951942-14.txt
Updating index
Running: /run/current-system/sw/bin/curl 'http://hackage.fpcomplete.com/01-index.tar.gz' --output /tmp/transportAdapterGet951942-16 --location --write-out '%{http_code}' --user-agent 'cabal-install/3.10.3.0 (linux; x86_64)' --silent --show-error --dump-header /tmp/curl-headers951942-17.txt --header 'Range: bytes=122536125-122978166'
Exception Unexpected response 416 for
http://hackage.fpcomplete.com/01-index.tar.gz when using mirror
http://hackage.fpcomplete.com/
Selected mirror http://objects-us-east-1.dream.io/hackage-mirror/
Downloading timestamp
Running: /run/current-system/sw/bin/curl 'http://objects-us-east-1.dream.io/hackage-mirror/timestamp.json' --output /tmp/transportAdapterGet951942-19 --location --write-out '%{http_code}' --user-agent 'cabal-install/3.10.3.0 (linux; x86_64)' --silent --show-error --dump-header /tmp/curl-headers951942-20.txt
Downloading snapshot
Running: /run/current-system/sw/bin/curl 'http://objects-us-east-1.dream.io/hackage-mirror/snapshot.json' --output /tmp/transportAdapterGet951942-22 --location --write-out '%{http_code}' --user-agent 'cabal-install/3.10.3.0 (linux; x86_64)' --silent --show-error --dump-header /tmp/curl-headers951942-23.txt
Updating index
Running: /run/current-system/sw/bin/curl 'http://objects-us-east-1.dream.io/hackage-mirror/01-index.tar.gz' --output /tmp/transportAdapterGet951942-25 --location --write-out '%{http_code}' --user-agent 'cabal-install/3.10.3.0 (linux; x86_64)' --silent --show-error --dump-header /tmp/curl-headers951942-26.txt --header 'Range: bytes=122536125-122978166'
Unexpected response 416 for http://objects-us-east-1.dream.io/hackage-mirror/01-index.tar.gz

Has anyone seen this? Is Hackage (and all its mirrors) broken somehow? Or do I have something badly misconfigured? Is my network somehow broken? I can’t remember any change I’ve done other than connecting to a different wifi.

Is it something that you can reproduce today? It might just be that caches are not synchronized and you somehow got a different cache instance which wasn’t updated yet.

EDIT: Didn’t see your post was so new. So I’d suggest seeing if this is still reproducible tomorrow instead of ‘today’ :wink:

For what it’s worth, things are working fine over here:

> cabal update -v
Project settings changed, reconfiguring...
Downloading the latest package list from hackage.haskell.org
Including the following directories in PATH:
- /home/laurent/.cabal/bin
Selected mirror http://hackage.haskell.org/
Downloading timestamp
Running: /usr/bin/curl 'http://hackage.haskell.org/timestamp.json' --output /tmp/transportAdapterGet16556-1 --location --write-out '%{http_code}' --user-agent 'cabal-install/3.10.3.0 (linux; x86_64)' --silent --show-error --dump-header /tmp/curl-headers16556-2.txt
Downloading snapshot
Running: /usr/bin/curl 'http://hackage.haskell.org/snapshot.json' --output /tmp/transportAdapterGet16556-4 --location --write-out '%{http_code}' --user-agent 'cabal-install/3.10.3.0 (linux; x86_64)' --silent --show-error --dump-header /tmp/curl-headers16556-5.txt
Updating index
Running: /usr/bin/curl 'http://hackage.haskell.org/01-index.tar.gz' --output /tmp/transportAdapterGet16556-7 --location --write-out '%{http_code}' --user-agent 'cabal-install/3.10.3.0 (linux; x86_64)' --silent --show-error --dump-header /tmp/curl-headers16556-8.txt --header 'Range: bytes=122639120-122978642'
Waiting to acquire cache lock on
/home/laurent/.cabal/packages/hackage.haskell.org/hackage-security-lock
Acquired cache lock on
/home/laurent/.cabal/packages/hackage.haskell.org/hackage-security-lock
Released cache lock on
/home/laurent/.cabal/packages/hackage.haskell.org/hackage-security-lock
Package list of hackage.haskell.org has been updated.
The index-state is set to 2024-06-25T13:23:55Z.
To revert to previous state run:
    cabal v2-update 'hackage.haskell.org,2024-06-11T19:52:27Z'
1 Like

Thanks for testing, Laurent. I notice your output lacks fpcomplete links, which @turion’s has.
Maybe that is part of the problem?

Yeah, the fpcomplete mirror must be the issue. There is probably a line like this in your ~/.cabal/config file:

remote-repo: hackage.fpcomplete.com:https://hackage.fpcomplete.com/

Removing that should fix the issue.

The fpcomplete mirror is probably discovered automatically, so I doubt this will solve the issue.

1 Like

It’s also missing references to the dream host mirror, so that might be a red herring. It’s also also missing the original 416 returned by the “mirror” hackage.haskell.org.

I recall discovering that cabal prints confusing error messages in the context of lookup failures. (When all Hackage mirrors fail, only the last is reported · Issue #9516 · haskell/cabal · GitHub).

I would guess that Hackage really did respond with a 416, and the mirrors had to do the same thing. I don’t know what the underlying cause would be, however.

1 Like

Note that 416 is an error about a range not being satisfiable, and cabal is doing an incremental update with a specified range header: 'Range: bytes=122536125-122978166'. I suspect there was some issue where the cached snapshot range did not match the actual range of the index tgz – perhaps because the local network “helpfully” cached the snapshot.json or index.tgz file?

one way to clear this out could be to delete or move the local copy of the index tgz to force cabal to refetch the entire thing – but i would also hope that this sort of issue would clear up once whatever local caching was causing things to be unsynced was fixed.

2 Likes