jdx/mise · error
cannot export ' ': use a shorthand attribute such as…
Error message
cannot export '{spec}': use a shorthand attribute such as nix:ripgrep; the importing NixOS configuration owns the package source What it means
`mise bootstrap packages export --format nix` renders installed `nix:` bootstrap packages as a NixOS module whose packages resolve against the importing configuration's `pkgs`. The export refuses package specs parsed as explicit sources (flake refs like `github:owner/repo#pkg`, store paths, expressions) because a NixOS module can only reference attributes of the importing pkgs set — the package source must be owned by the importing configuration.
Solutions
- Replace the explicit-source spec in `[bootstrap.packages]` with a plain nixpkgs attribute shorthand, e.g. `nix:ripgrep` instead of `nix:github:owner/repo#ripgrep`.
- Keep the flake-based package out of mise bootstrap packages and declare it directly in your NixOS configuration or an overlay.
- If a nixpkgs attribute exists for the software, install that attribute (possibly from a pinned nixpkgs input in the NixOS config) so it is exportable.
Example fix
# before (mise.toml) [bootstrap.packages] "nix:github:owner/repo#hello" = "latest" # after [bootstrap.packages] "nix:hello" = "latest"
Defensive patterns
Strategy: validation
Validate before calling
// Before export, ensure every nix: spec is a plain attribute shorthand
const explicit = /(^|:)(github|gitlab|sourcehut|git|file|path|flake|nixpkgs)[:/]/;
const bad = Object.keys(packages).filter(k => k.startsWith("nix:") && explicit.test(k.slice(4)));
if (bad.length) throw new Error(`non-shorthand nix specs not exportable: ${bad.join(", ")}`); Type guard
const isShorthandNixSpec = (spec) =>
spec.startsWith("nix:") && /^[A-Za-z0-9_.-]+(\.[A-Za-z0-9_.-]+)*$/.test(spec.slice(4)); Prevention
- Prefer plain nixpkgs attribute shorthands (nix:ripgrep) in [bootstrap.packages].
- Keep flake/store-path packages in your NixOS config, not mise bootstrap packages.
- Review [bootstrap.packages] for flake refs (`github:`, `git:`) before running export.
When it happens
Trigger: Running `mise bootstrap packages export --format nix` when `[bootstrap.packages]` contains a spec like `nix:github:owner/repo#hello`, a nix store path, or an embedded Nix expression instead of a plain attribute path such as `nix:ripgrep` (Installable::parse sets explicit=true).
Common situations: Users installed a package from a flake or tarball via `mise bootstrap packages install nix:github:...` and later try to reproduce their setup on NixOS by exporting; the flake-installed package cannot be represented as `pkgs.<attr>`.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- cannot export version pin
- Check command must not be empty
- collection updates require scalar or array values
- config file not found
- config file not found
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/5e25c1d20fc3802b.
Report an issue: GitHub.
Appendix: source
Thrown at src/cli/system/export.rs:56
let module = render(
packages
.iter()
.map(|(spec, package)| (spec.as_str(), package.version())),
)?;
miseprint!("{module}")?;
Ok(())
}
}
fn render<'a>(packages: impl IntoIterator<Item = (&'a str, &'a str)>) -> Result<String> {
let mut attributes = std::collections::BTreeSet::new();
for (spec, version) in packages {
let name = spec
.strip_prefix("nix:")
.ok_or_else(|| eyre::eyre!("expected a nix: package: {spec}"))?;
let request = Installable::parse(name)?;
if request.explicit {
bail!(
"cannot export '{spec}': use a shorthand attribute such as nix:ripgrep; the importing NixOS configuration owns the package source"
);
}
if version != "latest" {
bail!(
"cannot export version pin '{spec}' = '{version}': pin nixpkgs in the importing NixOS configuration instead"
);
}
attributes.insert(
request
.attribute
.split('.')
.map(nix_string)
.collect::<Vec<_>>()
.join("."),
);
}
let mut output = String::from(View on GitHub (pinned to 533346cc37)