Lockfile with Git conflict markers crashes Lix #697

Closed
opened 2025-02-24 07:02:31 +00:00 by goorzhel · 3 comments

Describe the bug

I got this stack trace while rebasing my NixOS repo:

nlohmann::json_abi_v3_11_3::detail::parse_error
Lix crashed. This is a bug. We would appreciate if you report it along with what caused it at https://git.lix.systems/lix-project/lix/issues with the following information included:

Exception: nlohmann::json_abi_v3_11_3::detail::parse_error: [json.exception.parse_error.101] parse error at line 450, column 1: syntax error while parsing object key - invalid literal; last read: '"locked": {<U+000A><'; expected string literal
Stack trace:
 0# nix::printStackTrace() in /nix/store/5scf0nbm0j6b2g4szwc4wkymgdzpk6b2-lix-2.92.0/lib/liblixutil.so
 1# 0x00007F1CE3EF0766 in /nix/store/5scf0nbm0j6b2g4szwc4wkymgdzpk6b2-lix-2.92.0/lib/liblixmain.so
 2# 0x00007F1CE2CBC20A in /nix/store/4gk773fqcsv4fh2rfkhs9bgfih86fdq8-gcc-13.3.0-lib/lib/libstdc++.so.6
 3# 0x00007F1CE2CBC275 in /nix/store/4gk773fqcsv4fh2rfkhs9bgfih86fdq8-gcc-13.3.0-lib/lib/libstdc++.so.6
 4# nix::handleExceptions(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void ()>) in /nix/store/5scf0nbm0j6b2g4szwc4wkymgdzpk6b2-lix-2.92.0/lib/liblixmain.so
 5# 0x000055998CC1529B in /run/current-system/sw/bin/nix
 6# 0x00007F1CE2A3127E in /nix/store/nqb2ns2d1lahnd5ncwmn6k84qfd7vx2k-glibc-2.40-36/lib/libc.so.6
 7# __libc_start_main in /nix/store/nqb2ns2d1lahnd5ncwmn6k84qfd7vx2k-glibc-2.40-36/lib/libc.so.6
 8# 0x000055998CB69D15 in /run/current-system/sw/bin/nix

This is because:

  1. I have direnv, which re-evaluates flake.nix every time it or the lockfile changes; and
  2. there was a Git conflict in flake.lock.

Steps to reproduce

Cause a Git conflict in flake.lock—or, more simply, render flake.lock unparseable.

Here's mine
diff --cc flake.lock
index 734853d,cf61e1f..0000000
--- a/flake.lock
+++ b/flake.lock
@@@ -448,8 -448,8 +448,15 @@@
      "secrets": {
        "locked": {
++<<<<<<< HEAD
 +        "lastModified": 1737850203,
 +        "narHash": "sha256-ZlWpZs+EcxsM5piY+qrT3cghOdjvW4e8wrXtk2UAeHE=",
 +        "ref": "refs/heads/main",
 +        "rev": "5dc9a51432d8b7da33efba9a171a4f9cee7c02f3",
++=======
+         "lastModified": 1740377307,
+         "narHash": "sha256-xRXBoawr8o+gUcOT4LME1fV/QLOORaxR1rjBBInnaQc=",
+         "ref": "refs/heads/main",
+         "rev": "5019623b038750a3fa5545b5b6388689e3342d19",
++>>>>>>> 1e44eac (Update secrets)
          "shallow": true,
          "type": "git",

I've attached the whole flake.lock.

Expected behavior

Not a crash, I suppose. A human-friendly error like "lockfile doesn't parse".

nix --version output

2.92.0
nix (Lix, like Nix) 2.92.0
System type: x86_64-linux
Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf
User configuration files: /home/ag/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/home/ag/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/ag/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/ag/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf
Store directory: /nix/store
State directory: /nix/var/nix
Data directory: /nix/store/5scf0nbm0j6b2g4szwc4wkymgdzpk6b2-lix-2.92.0/share
## Describe the bug I got this stack trace while rebasing my NixOS repo: <details> <summary>nlohmann::json_abi_v3_11_3::detail::parse_error</summary> ``` Lix crashed. This is a bug. We would appreciate if you report it along with what caused it at https://git.lix.systems/lix-project/lix/issues with the following information included: Exception: nlohmann::json_abi_v3_11_3::detail::parse_error: [json.exception.parse_error.101] parse error at line 450, column 1: syntax error while parsing object key - invalid literal; last read: '"locked": {<U+000A><'; expected string literal Stack trace: 0# nix::printStackTrace() in /nix/store/5scf0nbm0j6b2g4szwc4wkymgdzpk6b2-lix-2.92.0/lib/liblixutil.so 1# 0x00007F1CE3EF0766 in /nix/store/5scf0nbm0j6b2g4szwc4wkymgdzpk6b2-lix-2.92.0/lib/liblixmain.so 2# 0x00007F1CE2CBC20A in /nix/store/4gk773fqcsv4fh2rfkhs9bgfih86fdq8-gcc-13.3.0-lib/lib/libstdc++.so.6 3# 0x00007F1CE2CBC275 in /nix/store/4gk773fqcsv4fh2rfkhs9bgfih86fdq8-gcc-13.3.0-lib/lib/libstdc++.so.6 4# nix::handleExceptions(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void ()>) in /nix/store/5scf0nbm0j6b2g4szwc4wkymgdzpk6b2-lix-2.92.0/lib/liblixmain.so 5# 0x000055998CC1529B in /run/current-system/sw/bin/nix 6# 0x00007F1CE2A3127E in /nix/store/nqb2ns2d1lahnd5ncwmn6k84qfd7vx2k-glibc-2.40-36/lib/libc.so.6 7# __libc_start_main in /nix/store/nqb2ns2d1lahnd5ncwmn6k84qfd7vx2k-glibc-2.40-36/lib/libc.so.6 8# 0x000055998CB69D15 in /run/current-system/sw/bin/nix ``` </details> This is because: 1. I have `direnv`, which re-evaluates `flake.nix` every time it or the lockfile changes; and 2. there was a Git conflict in `flake.lock`. ## Steps to reproduce Cause a Git conflict in `flake.lock`—or, more simply, render `flake.lock` unparseable. <details> <summary>Here's mine</summary> ``` diff --cc flake.lock index 734853d,cf61e1f..0000000 --- a/flake.lock +++ b/flake.lock @@@ -448,8 -448,8 +448,15 @@@ "secrets": { "locked": { ++<<<<<<< HEAD + "lastModified": 1737850203, + "narHash": "sha256-ZlWpZs+EcxsM5piY+qrT3cghOdjvW4e8wrXtk2UAeHE=", + "ref": "refs/heads/main", + "rev": "5dc9a51432d8b7da33efba9a171a4f9cee7c02f3", ++======= + "lastModified": 1740377307, + "narHash": "sha256-xRXBoawr8o+gUcOT4LME1fV/QLOORaxR1rjBBInnaQc=", + "ref": "refs/heads/main", + "rev": "5019623b038750a3fa5545b5b6388689e3342d19", ++>>>>>>> 1e44eac (Update secrets) "shallow": true, "type": "git", ``` </details> I've attached the whole `flake.lock`. ## Expected behavior Not a crash, I suppose. A human-friendly error like "lockfile doesn't parse". ## `nix --version` output <details> <summary>2.92.0</summary> ``` nix (Lix, like Nix) 2.92.0 System type: x86_64-linux Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux Features: gc, signed-caches System configuration file: /etc/nix/nix.conf User configuration files: /home/ag/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/home/ag/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/ag/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/ag/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf Store directory: /nix/store State directory: /nix/var/nix Data directory: /nix/store/5scf0nbm0j6b2g4szwc4wkymgdzpk6b2-lix-2.92.0/share ``` </details>
Owner

Duplicate of #661 I believe.

Duplicate of https://git.lix.systems/lix-project/lix/issues/661 I believe.
jade 2025-02-25 01:27:57 +00:00
Author

D'oh, I thought I searched before filing. My bad.

D'oh, I thought I searched before filing. My bad.
Owner

In your defense the forgejo search in fuzzy mode is practically unusable. Exact mode is a little bit better, but I've mostly just been finding stuff by disciplined use of the labels.

In your defense the forgejo search in fuzzy mode is practically unusable. Exact mode is a little bit better, but I've mostly just been finding stuff by disciplined use of the labels.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#697
No description provided.