Search code examples
macoshaskellzlib

How to address Zlib data stream format error when generating hoogle database?


I am trying to generate a local hoogle database for its eventual use in a Haskell LSP with neovim.

Currently I'm running MacOS Monterey (12.6). I installed hoogle version 5.10.18.3 via cabal.

When running hoogle generate I get the following message:

$ hoogle generate
Starting generate
Reading Cabal... hoogle: Codec.Compression.Zlib: compressed data stream format error (incorrect header check)

Does anyone have an idea of how to proceed? Typing hoogle --help or hoogle generate --help does not give much information.


Solution

  • Try hoogle generate --download.

    You probably had a corrupted download somehow. When hoogle attempts to re-generate the database it does not by default download. Hoogle documentation

    Index all of Stackage

    Run hoogle generate to generate an index for the current version of Stackage LTS. This command downloads the necessary inputs from the web as required and caches them (in the same directory as the database). To force redownloading pass --download. To demand no downloading, failing if the data cannot be found, pass --download=no. Links to the results will point at Hackage.

    When I ran the --download flag, these files were fetched:

    Downloading https://www.stackage.org/nightly/cabal.config... 1.81s
    Downloading https://www.stackage.org/lts/cabal.config... 0.75s
    Downloading https://raw.githubusercontent.com/haskell/haskell-platform/master/hptool/src/Releases2015.hs... 1.34s
    Downloading https://hackage.haskell.org/packages/index.tar.gz... 3.67s
    Downloading https://hackage.haskell.org/packages/hoogle.tar.gz... 6.89s