Need help with this git related flake update error

I have variations of this strange error (flake update error attachment (discourse) · GitHub) when nix flake update recently.
The system where this occurs is NixOS in a WSL container (NixOS-WSL).
The error occurs even with freshly initialized flakes changing an input’s repositories’ branch.
Another system based on the same multi-system flake, but nix-only (Archlinux) and at an older flake revision (less recent inputs) does not show that error.

error:
       … while updating the lock file of flake 'git+file:///home/nixos/.nix-config?ref=refs/heads/master&rev=280d91ed26b605fed9467aac7a12ca9886b3c508'

       … while updating the flake input 'ghc-nixpkgs-unstable'

       … while fetching the input 'github:NixOS/nixpkgs/e1ee359d16a1886f0771cc433a00827da98d861c'

       error: adding a file to a tree builder: failed to insert entry: invalid object specified - default.nix

Preceeding the final error message gathered these log entries:

id not find cache entry for ‘gitRevToTreeHash:{“rev”:“e1ee359d16a1886f0771cc433a00827da98d861c”}’
unpacking ‘github:NixOS/nixpkgs/e1ee359d16a1886f0771cc433a00827da98d861c’ into the Git cache…
downloading ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’…
starting download of https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz
curl: Couldn’t find host github.com in the /etc/nix/netrc file; using defaults
curl: Found bundle for host: 0x559a130ba2a0 [can multiplex]
curl: Re-using existing connection with host github.com
curl: [HTTP/2] [7] OPENED stream for https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz
curl: [HTTP/2] [7] [:method: GET]
curl: [HTTP/2] [7] [:scheme: https]
curl: [HTTP/2] [7] [:authority: github.com]
curl: [HTTP/2] [7] [:path: /NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz]
curl: [HTTP/2] [7] [user-agent: curl/8.8.0 Nix/2.24.1]
curl: [HTTP/2] [7] [accept: /]
curl: [HTTP/2] [7] [accept-encoding: zstd, br, gzip, deflate, bzip2, xz]
curl: Request completely sent off
download thread waiting for 100 ms
download thread waiting for 100 ms
download thread waiting for 100 ms
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: HTTP/2 302
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: server: GitHub.com
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: date: Tue, 13 Aug 2024 10:40:16 GMT
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: content-type: text/html; charset=utf-8
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, Accept-Encoding, Accept, X-Requested-With
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: location: https://codeload.github.com/NixOS/nixpkgs/tar.gz/e1ee359d16a1886f0771cc433a00827da98d861c
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: cache-control: max-age=0, private
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: strict-transport-security: max-age=31536000; includeSubdomains; preload
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: x-frame-options: deny
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: x-content-type-options: nosniff
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: x-xss-protection: 0
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: referrer-policy: no-referrer-when-downgrade
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: content-security-policy: default-src ‘none’; base-uri ‘self’; child-src github.com/assets-cdn/worker/ webpack · GitHub assets (jQuery Plugins Site Reserved Word) · GitHub gist.github.com/assets-cdn/worker/; connect-src ‘self’ uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com .rel.tunnels.api.visualstudio.com wss://.rel.tunnels.api.visualstudio.com api.githubcopilot.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com/v1/engines/github-completion/completions proxy.enterprise.githubcopilot.com/v1/engines/github-completion/completions .actions.githubusercontent.com wss://.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com; font-src github.githubassets.com; form-action ‘self’ github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors ‘none’; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src ‘self’ data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src ‘self’; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src ‘unsafe-inline’ github.githubassets.com; upgrade-insecure-requests; worker-src github.com/assets-cdn/worker/ webpack · GitHub assets (jQuery Plugins Site Reserved Word) · GitHub gist.github.com/assets-cdn/worker/
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: content-length: 0
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: x-github-request-id: FE9F:AADDC:1F90CBF:202FAE2:66BB380D
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’:
curl: Ignoring the response-body
curl: Connection #1 to host github.com left intact
curl: Issue another request to this URL: ‘https://codeload.github.com/NixOS/nixpkgs/tar.gz/e1ee359d16a1886f0771cc433a00827da98d861c
curl: Couldn’t find host codeload.github.com in the /etc/nix/netrc file; using defaults
curl: Found bundle for host: 0x7efe080ba580 [can multiplex]
curl: Re-using existing connection with host codeload.github.com
curl: [HTTP/2] [7] OPENED stream for https://codeload.github.com/NixOS/nixpkgs/tar.gz/e1ee359d16a1886f0771cc433a00827da98d861c
curl: [HTTP/2] [7] [:method: GET]
curl: [HTTP/2] [7] [:scheme: https]
curl: [HTTP/2] [7] [:authority: codeload.github.com]
curl: [HTTP/2] [7] [:path: /NixOS/nixpkgs/tar.gz/e1ee359d16a1886f0771cc433a00827da98d861c]
curl: [HTTP/2] [7] [user-agent: curl/8.8.0 Nix/2.24.1]
curl: [HTTP/2] [7] [accept: /]
curl: [HTTP/2] [7] [accept-encoding: zstd, br, gzip, deflate, bzip2, xz]
download thread waiting for 100 ms
curl: Request completely sent off
download thread waiting for 100 ms
download thread waiting for 100 ms
download thread waiting for 100 ms
download thread waiting for 100 ms
download thread waiting for 100 ms
download thread waiting for 100 ms
download thread waiting for 100 ms
download thread waiting for 100 ms
download thread waiting for 100 ms
download thread waiting for 100 ms
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: HTTP/2 200
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: access-control-allow-origin:
https://render.githubusercontent.com
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: content-disposition: attachment; filename=nixpkgs-e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: content-security-policy: default-src ‘none’; style-src ‘unsafe-inline’; sandbox
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: content-type: application/x-gzip
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: cross-origin-resource-policy: cross-origin
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: etag: W/“d5673aa65c88a241565273cf95bd895d7f80becde2e5dbcb62e7a76e6a6f8c52”
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: strict-transport-security: max-age=31536000
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: vary: Authorization,Accept-Encoding,Origin
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: x-content-type-options: nosniff
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: x-frame-options: deny
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: x-xss-protection: 1; mode=block
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: date: Tue, 13 Aug 2024 10:40:17 GMT
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’: x-github-request-id: 6A7F:3517BF:16A1DF:1C327E:66BB380D
got header for ‘https://github.com/NixOS/nixpkgs/archive/e1ee359d16a1886f0771cc433a00827da98d861c.tar.gz’:

Updating the entry:

warning: updating lock file '/home/nixos/.nix-config/flake.lock':
• Updated input 'ghc-nixpkgs-unstable':
    'github:NixOS/nixpkgs/e1ee359d16a1886f0771cc433a00827da98d861c?narHash=sha256-Qy2e5VZRoLZ61ee7XmuaUOUgprW3AyE0uLyfohTPxMM%3D' (2023-10-06)
  → 'github:NixOS/nixpkgs/270dace49bc95a7f88ad187969179ff0d2ba20ed?narHash=sha256-POof6A43PHty3CgR67ADZEQRuPWX9FhL0sMzp3a4jOE%3D' (2024-07-06)

the flake is updated, although still it isn’t clear to me why the update didn’t work as well for unrelated flakes on the system with similar errors.

FYI: (set -i; GIT_TRACE=2 GIT_CURL_VERBOSE=2 GIT_TRACE_PERFORMANCE=2 GIT_TRACE_PACK_ACCESS=2 GIT_TRACE_PACKET=2 GIT_TRACE_PACKFILE=2 GIT_TRACE_SETUP=2 GIT_TRACE_SHALLOW=2 nix flake update ghc-nixpkgs-unstable --show-trace -vvvvv) 2>&1 | tee update.log ; set +i

Leaving this unsolved.

New datapoint: Having nix registry in place with nixpkgs pointing to my system flake’s input (nixos-24.05 repo branch) I removed both nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; and nixos.url = "github:nixos/nixpkgs/nixos-22.05"; from the sample flake listed here: GitHub - GTrunSec/photoprism2nix.
Using nix flake show followed by a nix flake update, the sample flake was now updatable/ed as opposed to the situation before I made the inputs’ changes:

warning: updating lock file ‘/home/nixos/photoprism2nix/flake.lock’:
• Updated input ‘flake-compat’:
‘github:edolstra/flake-compat/b4a34015c698c7793d592d66adbab377907a2be8?narHash=sha256-Z%2Bs0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh%2BE%3D’ (2022-04-19)
→ ‘github:edolstra/flake-compat/0f9255e01c2351cc7d116c072cb317785dd33b33?narHash=sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U%3D’ (2023-10-04)
• Updated input ‘flake-utils’:
‘github:numtide/flake-utils/c0e246b9b83f637f4681389ecabcb2681b4f3af0?narHash=sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc%3D’ (2022-08-07)
→ ‘github:numtide/flake-utils/b1d9ab70662946ef0850d488da1c9019f3a9752a?narHash=sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ%3D’ (2024-03-11)
• Added input ‘flake-utils/systems’:
‘github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e?narHash=sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768%3D’ (2023-04-09)
• Updated input ‘gomod2nix’:
‘github:tweag/gomod2nix/89cd0675b96775aa3ee86e7c0cf5bc238dd27976?narHash=sha256-4BKeqCX2zwgBiTdlc2DjGQ0CttKm0vSw0r/bdFdM/PQ%3D’ (2022-09-06)
→ ‘github:tweag/gomod2nix/4e08ca09253ef996bd4c03afa383b23e35fe28a1?narHash=sha256-sbbA8b6Q2vB/t/r1znHawoXLysCyD4L/6n6/RykiSnA%3D’ (2024-08-02)
• Added input ‘gomod2nix/flake-utils’:
‘github:numtide/flake-utils/ff7b65b44d01cf9ba6a71320833626af21126384?narHash=sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt%2BxmY%3D’ (2023-09-12)
• Added input ‘gomod2nix/flake-utils/systems’:
‘github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e?narHash=sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768%3D’ (2023-04-09)
• Removed input ‘gomod2nix/utils’
• Updated input ‘npmlock2nix’:
‘github:nix-community/npmlock2nix/5c4f247688fc91d665df65f71c81e0726621aaa8?narHash=sha256-9pXHDpIjmsK5390wmpGHu9aA4QOPpegPBvThHeBlef4%3D’ (2022-06-09)
→ ‘github:nix-community/npmlock2nix/9197bbf397d76059a76310523d45df10d2e4ca81?narHash=sha256-sJM82Sj8yfQYs9axEmGZ9Evzdv/kDcI9sddqJ45frrU%3D’ (2023-01-11)
• Updated input ‘photoprism’:
‘github:photoprism/photoprism/47929566dbd0080df60b1cbb187fc05f37fe3e74?narHash=sha256-gDTjoz1np3rrszA4RnxjP09b2ooEKEIpk7C3H8CbnxE%3D’ (2022-09-28)
→ ‘github:photoprism/photoprism/9c2f7b4c6906b35004ba7121d32c0d1c7a120381?narHash=sha256-QRBNXApwrvj9H1qcS6qPzZObmU2fpLTNJk3Duc8Y3Xg%3D’ (2024-08-12)

Does this seem like a bug to you?

Given that I first had my nix registry oddly configured, nixpkgs pointing to the default nixpkgs-unstable while my system’s flake had nixpkgs pointing to nixos-24.05 I cannot tell with confidence if a bug on nixpkgs is the reason or not.

EDIT: At least I expect the nix flake update to work just without a preceeding incantation of any of nix flake show and sorts, so this protocol change unaligned with users’ habits might qualify as some kind of bug.

Maybe someone else observed analog traits ? Would you suggest a bug ticket ?

On another note, I already disabled nvidia-related settings, minimized my overlay a bit as well as disabled some hack, where I took sane module from nixos-22.11 back then to enable scanner detection in simple-scan on one of my systems, that is non-NixOS.

1 Like

Worked around this using nix run nixpkgs#nixVersions.nix_2_20 -- flake update nixos-unstable.

hi, sorry for the necro, but I’m a bit new to Nix (all I use it for is just managing my dotfiles with home-manager), and normally I just go home-manager switch --flake . every once in a while with some nix flake updates thrown in when I want everything to be the latest versions

I’m getting this error (except instead of default.nix it’s discourse.md) and the linked GitHub thread isn’t much help in resolving it, and nix run nixpkgs... command doesn’t work for me either—that fails while fetching the nixpkgs-unstable input

It’s a really annoying bug and I hope it be fixed ASAP…

I tried nix-garbage-collect -d, nix run nixpkgs#nixVersions.nix_2_20 -- flake update nixos-unstable, deleting ~/.cache/nix but the error error: adding a file to a tree builder: failed to insert entry: invalid object specified - 2024-06-14.nix persists.