Skip to content

error: input compression not recognized (private cache using zstd compression) #11261

Open

Description

@andrewhamon

Describe the bug

When I run nix build, I repeatedly get an error about compression when trying to substitute from a private cache.

error: input compression not recognized
error: some substitutes for the outputs of derivation '/nix/store/l59dvqj9lbm2n5agfx19hxbm2qlq4w0g-pnpm-9.0.6.tgz.drv' failed (usually happens due to networking issues); try '--fallback' to build derivation from source

The pnpm package in question is our own package that has this as its src:

  src = pkgs.fetchurl {
    url = "https://registry.npmjs.org/pnpm/-/pnpm-${version}.tgz";
    sha256 = "sha256-BiTjDv+GbN6zY7FQYb23/ZQlsXvBu0LCL19O/eoh9rM=";
  };

Steps To Reproduce

  1. build a derivation that uses that src
  2. push to a cache using zstd compression
  3. clear your local nix store (rm result && nix-collect-garbage -d)
  4. build again using your cache
  5. see the error (can only fix by adding --fallback to the build)

Expected behavior

Cache substitutes correctly, or gives better advice on how to rectify the error.

nix-env --version output

nix-env (Nix) 2.23.3

Additional context

I only hit this when using zstd compression on the cache. The cache is a a gcs bucket (but using a s3:// cache URI).

Priorities

Add 👍 to issues you find important.

Activity

  1. andrewhamon commented on Aug 5, 2024

    @andrewhamon
    ContributorAuthor

    I don't get this issue if I switch from compression=zstd to compression=gzip and overwrite the cache. So I think it is an issue specific to using zstd with a cache.

  2. nixos-discourse commented on Aug 13, 2024

    @nixos-discourse
  3. roberth commented on Aug 13, 2024

    @roberth
    Member

    Discussed during aforementioned Nix maintainers meeting:

    We have a test for zstd compression for a binary cache

    If this were HTTP, I would ask the following. S3 should be analogous.
    What does curl http(s)://your-cache.local/l59dvqj9lbm2n5agfx19hxbm2qlq4w0g.narinfo return?
    It should provide you with a nar.zstd filename.
    If you download that, is it in the correct file format?

    Possibly related: #7712

  4. Mic92 commented on Aug 14, 2024

    @Mic92
    Member

    Possibly related: #7712

    My PR was about http transport encoding (this is transparent to nix as curl handles it i.e. it should not appear in narinfo either), but the person here uses zstd compression on the content itself.

  5. andrewhamon commented on Aug 14, 2024

    @andrewhamon
    ContributorAuthor

    If I find some time, I'll see if I can reproduce using minio. Unfortunately, my main specimen was serving production use cases and I already did the cache surgery, so I can't easily grab that info you are requesting.

  6. xokdvium commented on Nov 5, 2024

    @xokdvium
    Contributor

    This gives me a strong feeling of Deja Vu with an issue I've tackled in #10341. The original problem I've had was also with minio but with a reverse proxy #10275.

    It would be helpful to see the http headers you get when downloading the nar. My guess is that this is once again TarArchive biting us in the rear.

    I thought it has been ironed out since there's a nixos test for substitution of gzip files with gzip Encoding-Type.

    Edit: Didn't catch that the cache is on plain S3

  7. andrewhamon commented on Nov 6, 2024

    @andrewhamon
    ContributorAuthor

    Edit: Didn't catch that the cache is on plain S3

    Well... it was gcloud using s3 compat

    I thought it has been ironed out since there's a nixos test for substitution of gzip files with gzip Encoding-Type.

    I've only seen this with non-gzip compression (i.e. zstd). So i wonder if its a zstd-in-gzip-stream bug.

    Unfortunately, since this happened on a production cache, I just did whatever cache surgery I could to recover and I no longer have any sample files that exhibit the behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions