Change:
Not a nixpkgs bug nor the cause of any failure
I ran into this when trying to build Bottles. In case anyone finds this issue and is trying to track down a potential source of it. There is a with a workout around for Bottles that is merged and to nixos-unstable.
Hi this issue's topic is unrelated to the error you're speaking of. See -- the line in this issue can be ignored. The actual issue is above that line in the pahelper build you're talking about:
:pray: thank you very much for clarifying that !
Is there some mitigation for this I can do? Because right now I'm getting this error when trying to build various Python packages and it is pretty annoying.
Either ignore it or backport the fix
How do I ignore it? It seems to break my builds.
No, your builds are failing for a different reason. The error in this issue occurs when the build fails at a certain point, you can just ignore it.
I still have this issue as of today. I'm recompiling to change shortcuts (that's how it is done). When invoking in the hook, I have the mentioned issue. I have had issues with (and the very same error message) in other derivations, too. This has probably nothing to do with . I just happen to use it regularly.
No surprise here, your grep command is failing (because ), so the build fails. Please try to keep on topic.
Ah, yes, you're right. It's the combination of the + grep failing. Thanks. Please try to be polite.
I backported the upstream fix in It looks like only one part of that commit was relevant to this bug, so it applies pretty cleanly.

Discussion:
patches = upstreamPatches ++ [ ./pgrp-pipe-5.patch <del> (fetchurl { name = "fix-static.patch"; url = "https://cgit.freebsd.org/ports/plain/shells/bash/files/patch-configure?id=3e147a1f594751a68fea00a28090d0792bee0b51"; sha256 = "XHFMQ6eXTReNoywdETyrfQEv1rKF8+XFbQZP4YoVKFk="; }) </del> # Apply parallel build fix pending upstream inclusion: #   https://savannah.gnu.org/patch/index.php?10373 # Had to fetch manually to workaround -p0 default. ./parallel.patch <ins> # Fix `pop_var_context: head of shell_variables not a function context`. ./fix-pop-var-context-error.patch </ins> ]; configureFlags = [

(patch "024" "1hq23djqbr7s9y2324jq9mxr5bwdkmgizn3zgpchbsqp054k85cp") (patch "025" "0x9hc4silzl4d3zw4p43i5dm7w86k50j47f87lracwfgwy3z8f2i") (patch "026" "1b1fhm1dsi67r8ip17s0xvx2qq31fsxc1g9n3r931dd0k9a1zvln") <ins> (patch "027" "0fdbhvs9dkf4knncifh98a76q4gylhyvfrffq5p9q3ag5q58jap1") (patch "028" "1hdacd6sssjshmry1sscdnxxfb2r51bvdyghlfjaqgc9l85phhk0") (patch "029" "11wrlb20w6v89b96krg0gwxipwhvrda6rq1y9f972m32gsrsqp0j") (patch "030" "13v9fqgim082dmvkslsr0hs793yzhsij2s91mjswsfhj1qip7zy3") (patch "031" "15d7rddj6spwc1fy997lxx6zvzq0zbxgf2h20mhi4wgp5nzbglf2") (patch "032" "05ia6yf32hjprmyyxqawhgckxs3684ikfx8xg08zfgx9xkd7g73v") </ins> ]

<ins> Excerpted from <https://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=055a4552c901e43e6a6007f5bc664a33698dbf85>. Original author: Chet Ramey <chet.ramey@case.edu> --- variables.c +++ variables.c @@ -5413,7 +5413,9 @@ pop_var_context () vcxt = shell_variables; if (vc_isfuncenv (vcxt) == 0) { -      internal_error (_("pop_var_context: head of shell_variables not a function context")); +      /* If we haven't flushed all of the local contexts already, flag an error */ +      if (shell_variables != global_variables || variable_context > 0) +	internal_error (_("pop_var_context: head of shell_variables not a function context")); return; } </ins>