jdx/mise · error

nix failed; see Nix's diagnostic above. Ensure nix-command…

Error message

nix {} failed; see Nix's diagnostic above. Ensure nix-command and flakes are enabled and the profile uses modern `nix profile` format

What it means

Mutating `nix` operations (`profile install`, `profile upgrade`) run through `action()` with stdout/stderr inherited, so Nix's own diagnostics print directly to the terminal. On non-zero exit, mise raises this short message telling you to read the diagnostic above rather than duplicating it, and highlighting the usual causes: disabled experimental features or a legacy profile format.

Solutions

  1. Read the Nix diagnostic printed above the error; fix the specific cause it names.
  2. Verify `experimental-features = nix-command flakes` is set in nix.conf.
  3. Run the exact `nix profile install/upgrade` command from the message manually with full output.
  4. Check network/auth if the diagnostic mentions fetching a flake (private repos need credentials/token setup).
  5. If the profile is corrupt, recreate it: `nix profile list` to inspect, remove broken entries, retry.

Example fix

# before (nix.conf)
# experimental-features absent

# after
experimental-features = nix-command flakes
Defensive patterns

Strategy: try-catch

Validate before calling

nix profile list --profile ~/.nix-profile --json >/dev/null 2>&1 && \
  nix flake metadata nixpkgs >/dev/null 2>&1 && echo ok || echo "fix nix setup first"

Try / catch

if let Err(e) = manager.install(&pkgs, &opts).await {
    // Nix already printed its diagnostic; surface it alongside mise's hint
    eprintln!("{}\ncheck: experimental-features, attribute name, network/auth", e);
}

Prevention

When it happens

Trigger: `nix profile install ...` or `nix profile upgrade ...` exits non-zero: flake/attribute not found, network/registry fetch failure, experimental features disabled, lockfile/profile issues, or store permission errors.

Common situations: Typo'd attribute names; private flakes requiring auth; offline builds; nix-command/flakes not enabled on a fresh machine; multi-user Nix permission problems; interrupted profile leaving a bad manifest.

Understand the failure class

Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/94cef4dfed342c71. Report an issue: GitHub.

Appendix: source

Thrown at src/system/packages/nix.rs:260

        || installed == format!("packages.{system}.{request}")
        || installed == format!("legacyPackages.{system}.{request}")
}

async fn action(args: Vec<String>, opts: &InstallOpts) -> Result<()> {
    if opts.dry_run {
        miseprintln!("nix {}", shell_words::join(&args));
        return Ok(());
    }
    debug!("$ nix {}", shell_words::join(&args));
    let status = tokio::process::Command::new("nix")
        .args(&args)
        .stdin(Stdio::null())
        .stdout(Stdio::inherit())
        .stderr(Stdio::inherit())
        .status()
        .await?;
    if !status.success() {
        bail!(
            "nix {} failed; see Nix's diagnostic above. Ensure nix-command and flakes are enabled and the profile uses modern `nix profile` format",
            shell_words::join(&args)
        );
    }
    Ok(())
}

fn reject_pins(pkgs: &[PackageRequest]) -> Result<()> {
    if let Some(pkg) = pkgs.iter().find(|p| p.version.is_some()) {
        bail!(
            "Nix cannot install package version pin '{pkg}'; pin the flake source revision instead"
        );
    }
    Ok(())
}

#[async_trait(?Send)]
impl SystemPackageManager for NixManager {

View on GitHub (pinned to 533346cc37)