Empty flake.lock causes lix to throw an exception #731

Closed
opened 2025-03-12 19:26:31 +00:00 by ninja3047 · 1 comment

Describe the bug

A flake.nix with an empty flake.lock causes lix to throw an exception.

Steps To Reproduce

  • Clone the lix repo
  • echo "">./flake.lock
  • Run nix develop
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 2, column 1: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal
Stack trace:
 0# nix::printStackTrace() in /nix/store/v6rpybz1pwr46kff20q7ddm28kkqcqqf-lix-2.92.0/lib/liblixutil.so
 1# 0x00007FC124EC6B26 in /nix/store/v6rpybz1pwr46kff20q7ddm28kkqcqqf-lix-2.92.0/lib/liblixmain.so
 2# 0x00007FC123EBF20A in /nix/store/2lhklm5aizx30qbw49acnrrzkj9lbmij-gcc-14-20241116-lib/lib/libstdc++.so.6
 3# std::unexpected() in /nix/store/2lhklm5aizx30qbw49acnrrzkj9lbmij-gcc-14-20241116-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/v6rpybz1pwr46kff20q7ddm28kkqcqqf-lix-2.92.0/lib/liblixmain.so
 5# 0x000056473F99989B in nix
 6# 0x00007FC123A2A1FE in /nix/store/6q2mknq81cyscjmkv72fpcsvan56qhmg-glibc-2.40-66/lib/libc.so.6
 7# __libc_start_main in /nix/store/6q2mknq81cyscjmkv72fpcsvan56qhmg-glibc-2.40-66/lib/libc.so.6
 8# 0x000056473F8EA875 in nix

fish: Job 1, 'nix develop' terminated by signal SIGABRT (Abort)

Expected behavior

A less scary error message that explains what is wrong and how it can be fixed.

nix --version output

nix (Lix, like Nix) 2.92.0
System type: x86_64-linux
Additional system types: aarch64-linux, i686-linux, mips-linux
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf
User configuration files: /home/user/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/home/user/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/user/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/user/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/v6rpybz1pwr46kff20q7ddm28kkqcqqf-lix-2.92.0/share

Additional context

## Describe the bug A flake.nix with an empty flake.lock causes lix to throw an exception. ## Steps To Reproduce * Clone the lix repo * `echo "">./flake.lock` * Run `nix develop` ``` 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 2, column 1: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal Stack trace: 0# nix::printStackTrace() in /nix/store/v6rpybz1pwr46kff20q7ddm28kkqcqqf-lix-2.92.0/lib/liblixutil.so 1# 0x00007FC124EC6B26 in /nix/store/v6rpybz1pwr46kff20q7ddm28kkqcqqf-lix-2.92.0/lib/liblixmain.so 2# 0x00007FC123EBF20A in /nix/store/2lhklm5aizx30qbw49acnrrzkj9lbmij-gcc-14-20241116-lib/lib/libstdc++.so.6 3# std::unexpected() in /nix/store/2lhklm5aizx30qbw49acnrrzkj9lbmij-gcc-14-20241116-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/v6rpybz1pwr46kff20q7ddm28kkqcqqf-lix-2.92.0/lib/liblixmain.so 5# 0x000056473F99989B in nix 6# 0x00007FC123A2A1FE in /nix/store/6q2mknq81cyscjmkv72fpcsvan56qhmg-glibc-2.40-66/lib/libc.so.6 7# __libc_start_main in /nix/store/6q2mknq81cyscjmkv72fpcsvan56qhmg-glibc-2.40-66/lib/libc.so.6 8# 0x000056473F8EA875 in nix fish: Job 1, 'nix develop' terminated by signal SIGABRT (Abort) ``` ## Expected behavior A less scary error message that explains what is wrong and how it can be fixed. ## `nix --version` output ``` nix (Lix, like Nix) 2.92.0 System type: x86_64-linux Additional system types: aarch64-linux, i686-linux, mips-linux Features: gc, signed-caches System configuration file: /etc/nix/nix.conf User configuration files: /home/user/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/home/user/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/user/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/user/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/v6rpybz1pwr46kff20q7ddm28kkqcqqf-lix-2.92.0/share ``` ## Additional context
Owner

fixed in HEAD, see #661 :)

fixed in HEAD, see https://git.lix.systems/lix-project/lix/issues/661 :)
jade 2025-03-12 21:12:04 +00:00
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#731
No description provided.