{"record":{"id":"75db7a54f52770fc","repo":"jdx/mise","slug":"invalid-nix-flake-reference-source-use-a-registry-name-url","errorCode":null,"errorMessage":"invalid Nix flake reference '{source}'; use a registry name, URL, or path:/absolute/path","messagePattern":"invalid Nix flake reference '(.+?)'; use a registry name, URL, or path:/absolute/path","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/nix.rs","lineNumber":38,"sourceCode":"    pub explicit: bool,\n}\n\nimpl<'a> Installable<'a> {\n    pub(crate) fn parse(name: &'a str) -> Result<Self> {\n        if name.chars().any(char::is_control) {\n            bail!(\"Nix package references must not contain control characters\");\n        }\n        let (source, attribute, explicit) = match name.split_once('#') {\n            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    }","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/nix.rs#L20-L56","documentation":"When a package reference contains `#`, the part before it is treated as an explicit flake source and must be a registry flake name, a flake URL (github:/git+https: etc.), or an absolute `path:/...` reference. The parser rejects empty sources, sources starting with `-`, `.`, or `/`, and relative `path:` refs, because such strings are not valid flake refs (and `-`-prefixed input could be misread as a CLI flag).","triggerScenarios":"`Installable::parse` sees a name with `#` whose prefix is empty (`#hello`), flag-like (`--expr#hello`), a plain relative path (`./local#hello`, `/tmp/x#hello`), or `path:relative#hello`.","commonSituations":"Users writing local-path packages as `./my-flake#pkg` instead of `path:/abs/my-flake#pkg`; typos like a leading `#` from copy-paste; treating mise package entries as raw nix expressions.","solutions":["Use an absolute path reference: `path:/absolute/path/to/flake#attribute`.","Use a registry flake name (`nixpkgs#ripgrep`) or a full flake URL (`github:owner/repo#attr`).","Remove stray leading `-`, `.`, `/`, or `#` characters from the source part.","Pin local flakes by absolute path plus revision in the flake URL if reproducibility is needed."],"exampleFix":"# before\npackages = [\"./local-flake#hello\"]\n\n# after\npackages = [\"path:/home/me/local-flake#hello\"]","handlingStrategy":"validation","validationCode":"fn looks_like_flake_source(src: &str) -> bool {\n    !src.is_empty()\n        && !src.starts_with(['-', '.', '/'])\n        && (!src.starts_with(\"path:\") || src.strip_prefix(\"path:\").unwrap().starts_with('/'))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use path:/absolute/... for local flakes","Use registry names or full URLs for sources","Never start a source with -, ., or /","Test references with `nix flake metadata <ref>` first"],"tags":["nix","flake-reference","validation","invalid-url"],"backgroundTag":"invalid-url-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"}