jdx/mise · error
invalid Nix package attribute
Error message
invalid Nix package attribute '{attribute}'; use a dotted attribute path (e.g. ripgrep or python3Packages.pip), or '<flake>#<attribute>'; pin versions in the flake reference, not with @version What it means
The part after `#` (or the whole name when no `#` is present) must be a valid Nix attribute path: non-empty dot-separated parts of ASCII alphanumerics, `_`, `-`, or `'`. This error fires for anything else — empty attributes, `^out` output selectors, `@version` suffixes, `..`, or special characters — because mise delegates versioning and output selection to the flake, not the package string.
Solutions
- Use a plain dotted attribute path: `ripgrep` or `python3Packages.pip`.
- Pin a version by pinning the flake source revision (e.g. `github:owner/repo/<rev>#pkg`), not with `@version`.
- Remove output selectors (`^out`) and Nix expression syntax from the attribute; select outputs in your own flake if needed.
- Check the exact attribute name in `nix search nixpkgs <pkg>` or the flake's `packages.<system>` output.
Example fix
# before packages = ["ripgrep@14.1.0"] # after packages = ["github:NixOS/nixpkgs/nixos-24.05#ripgrep"]
Defensive patterns
Strategy: validation
Validate before calling
fn valid_attribute(attr: &str) -> bool {
attr.split('.').all(|p| !p.is_empty()
&& p.chars().all(|c| c.is_ascii_alphanumeric() || matches!(c, '_' | '-' | '\'')))
} Prevention
- Never use pkg@version syntax with Nix packages
- Pin versions via flake URL revisions instead
- Verify attribute names with `nix search nixpkgs <pkg>`
- Avoid ^output selectors and Nix expressions in package strings
When it happens
Trigger: `Installable::parse` receives names like `hello@1.2`, `hello^out`, `hello..world`, `#` with an empty attribute, or attributes containing `/`, `$`, `${...}`, etc. Called from install, upgrade, and matching_entries.
Common situations: Users porting apt/npm habits and writing `pkg@version` (mise explicitly tells you to pin via the flake source revision instead); attempting Nix output selection (`^out`) or nixpkgs expressions inside the attribute; typos with double dots.
Understand the failure class
Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.
Related errors
- brew casks are installed at their current version
- invalid Nix flake reference
- Nix cannot install package version pin
- Nix package references must not contain control characters
- a repository preview directory requires a dry run
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/23b8c4ffc55c8418.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/packages/nix.rs:47
Some((source, attribute)) => {
if source.is_empty()
|| source.starts_with('-')
|| source.starts_with('.')
|| source.starts_with('/')
|| source
.strip_prefix("path:")
.is_some_and(|p| !p.starts_with('/'))
{
bail!(
"invalid Nix flake reference '{source}'; use a registry name, URL, or path:/absolute/path"
);
}
(source, attribute, true)
}
None => ("nixpkgs", name, false),
};
if !valid_attribute(attribute) {
bail!(
"invalid Nix package attribute '{attribute}'; use a dotted attribute path (e.g. ripgrep or python3Packages.pip), or '<flake>#<attribute>'; pin versions in the flake reference, not with @version"
);
}
Ok(Self {
source,
attribute,
explicit,
})
}
fn argument(&self) -> String {
format!("{}#{}", self.source, self.attribute)
}
}
fn valid_attribute(attribute: &str) -> bool {
attribute.split('.').all(|part| {
!part.is_empty()View on GitHub (pinned to 533346cc37)