{"record":{"id":"23b8c4ffc55c8418","repo":"jdx/mise","slug":"invalid-nix-package-attribute-attribute-use-a-dotted","errorCode":null,"errorMessage":"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","messagePattern":"invalid Nix package attribute '(.+?)'; use a dotted attribute path \\(e\\.g\\. ripgrep or python3Packages\\.pip\\), or '<flake>#<attribute>'; pin versions in the flake reference, not with @version","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/nix.rs","lineNumber":47,"sourceCode":"            Some((source, attribute)) => {\n                if source.is_empty()\n                    || source.starts_with('-')\n                    || source.starts_with('.')\n                    || source.starts_with('/')\n                    || source\n                        .strip_prefix(\"path:\")\n                        .is_some_and(|p| !p.starts_with('/'))\n                {\n                    bail!(\n                        \"invalid Nix flake reference '{source}'; use a registry name, URL, or path:/absolute/path\"\n                    );\n                }\n                (source, attribute, true)\n            }\n            None => (\"nixpkgs\", name, false),\n        };\n        if !valid_attribute(attribute) {\n            bail!(\n                \"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\"\n            );\n        }\n        Ok(Self {\n            source,\n            attribute,\n            explicit,\n        })\n    }\n\n    fn argument(&self) -> String {\n        format!(\"{}#{}\", self.source, self.attribute)\n    }\n}\n\nfn valid_attribute(attribute: &str) -> bool {\n    attribute.split('.').all(|part| {\n        !part.is_empty()","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/nix.rs#L29-L65","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","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."],"exampleFix":"# before\npackages = [\"ripgrep@14.1.0\"]\n\n# after\npackages = [\"github:NixOS/nixpkgs/nixos-24.05#ripgrep\"]","handlingStrategy":"validation","validationCode":"fn valid_attribute(attr: &str) -> bool {\n    attr.split('.').all(|p| !p.is_empty()\n        && p.chars().all(|c| c.is_ascii_alphanumeric() || matches!(c, '_' | '-' | '\\'')))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["nix","attribute-path","validation","version-pinning"],"backgroundTag":"invalid-identifier-format","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}