{"record":{"id":"015159690dd6d359","repo":"jdx/mise","slug":"ref-must-not-be-empty","errorCode":null,"errorMessage":"`ref` must not be empty","messagePattern":"`ref` must not be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/repos.rs","lineNumber":134,"sourceCode":"            for component in path.components() {\n                if let Component::Normal(segment) = component {\n                    resolved.push(segment);\n                }\n            }\n            resolved\n        };\n        let Some(url) = config.url.map(|s| s.trim().to_string()) else {\n            bail!(\"must set `url`\");\n        };\n        if url.is_empty() {\n            bail!(\"must set a non-empty `url`\");\n        }\n        if url.starts_with('-') {\n            bail!(\"`url` must not start with `-`\");\n        }\n        let git_ref = config.git_ref.map(|s| s.trim().to_string());\n        let git_ref = match git_ref {\n            Some(git_ref) if git_ref.is_empty() => bail!(\"`ref` must not be empty\"),\n            Some(git_ref) if git_ref.starts_with('-') => bail!(\"`ref` must not start with `-`\"),\n            other => other,\n        };\n        Ok(Self {\n            path_raw,\n            path,\n            url,\n            git_ref,\n        })\n    }\n}\n\nimpl std::fmt::Display for RepoRequest {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        write!(f, \"{}\", file::display_path(&self.path))\n    }\n}\n","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/system/repos.rs#L116-L152","documentation":"`ref` is optional in a repos entry, but when present it is trimmed and may not be empty. An empty ref would be passed to `git clone --branch <ref>` / `git checkout <ref>` and fail with an obscure git error, so from_toml rejects it at config-parse time.","triggerScenarios":"`ref = \"\"` or `ref = \"   \"` in an `[bootstrap.repos]` entry.","commonSituations":"Templating that leaves ref blank when a variable is unset; config generators emitting an empty ref key instead of omitting it.","solutions":["Delete the `ref` key entirely to track the default branch","Set a real branch name, tag, `refs/...` ref, or commit SHA"],"exampleFix":"# before\n\"~/src/x\" = { url = \"https://github.com/owner/repo.git\", ref = \"\" }\n\n# after\n\"~/src/x\" = { url = \"https://github.com/owner/repo.git\" }","handlingStrategy":"validation","validationCode":"fn repo_ref_is_usable(cfg: &RepoTomlConfig) -> bool {\n    cfg.git_ref.as_deref().is_none_or(|r| !r.trim().is_empty())\n}","typeGuard":"fn repo_ref_valid_or_absent(cfg: &RepoTomlConfig) -> bool {\n    cfg.git_ref.as_deref().map_or(true, |r| !r.trim().is_empty())\n}","tryCatchPattern":null,"preventionTips":["Emit no `ref` key rather than an empty one when templating config","Remember `ref` is optional — the default branch is tracked without it"],"tags":["mise","bootstrap","repos","config","validation"],"backgroundTag":"empty-config-value","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}