Skip to content

Assertion 'maybeOutputPath' failed in void main_nix_build #16389

Description

@chlohal

Describe the bug

I have a bug that seems to be triggered by impure derivations. The build crashes with this message:

terminating due to unexpected unrecoverable internal error: Assertion 'maybeOutputPath' failed in void main_nix_build(int, char**) at ../nix-build/nix-build.cc:730
Nix crashed. This is a bug. Please report this at https://github.com/NixOS/nix/issues with the following information included:

std::terminate() called without exception
Stack trace:
 0# 0x00005B20B869C141 in nix-build
 1# 0x00007C4EEE4BF1AA in /nix/store/0p8b2lqk47fvxm9hc6c8mnln5l8x51q1-gcc-14.3.0-lib/lib/libstdc++.so.6
 2# std::unexpected() in /nix/store/0p8b2lqk47fvxm9hc6c8mnln5l8x51q1-gcc-14.3.0-lib/lib/libstdc++.so.6
 3# 0x00007C4EEF2DB0DF in /nix/store/bcy8w5fsd9fjkdzl2h1mwr0c3b03k3wl-nix-util-2.34.6/lib/libnixutil.so.2.34.6
 4# __wrap___assert_fail in nix-build
 5# 0x00005B20B8775F48 in nix-build
 6# 0x00005B20B8714115 in nix-build
 7# nix::handleExceptions(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, nix::fun<void ()>) in /nix/store/bcy8w5fsd9fjkdzl2h1mwr0c3b03k3wl-nix-util-2.34.6/lib/libnixutil.so.2.34.6
 8# 0x00005B20B8671143 in nix-build
 9# 0x00007C4EEE02A4D8 in /nix/store/vr7ds8vwbl2fz7pr221d5y0f8n9a5wda-glibc-2.40-218/lib/libc.so.6
10# __libc_start_main in /nix/store/vr7ds8vwbl2fz7pr221d5y0f8n9a5wda-glibc-2.40-218/lib/libc.so.6
11# 0x00005B20B8675C85 in nix-build

Steps To Reproduce

Make a file test.nix with the following:

(import <nixpkgs> { }).stdenv.mkDerivation {
  name = "reproducer";
  __impure = true;

  buildCommand = ''
    mkdir $out
  '';
}

Run nix-build test.nix. It fails with the given error.

Expected behavior

The derivation should produce an empty output folder

Metadata

nix-env (Nix) 2.34.6

Additional context

The derivation works as expected when __impure = true; is removed

Checklist


Add 👍 to issues you find important.

Activity

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