{"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/533346cc374382b41ec5ff70536252b2e96e725c/src/system/repos.rs#L116-L152","documentation":"The optional `ref` key, when present, is trimmed and must not be empty. An empty ref would produce a malformed `git checkout \"\"` / fetch spec, so from_toml rejects it. Omitting `ref` entirely is fine; only an explicit empty value fails.","triggerScenarios":"Writing `ref = \"\"` or `ref = \"   \"` in a `[bootstrap.repos]` entry while also setting a url.","commonSituations":"Env/templated ref values that expanded to empty; clearing a branch name without removing the key; placeholder left in generated config.","solutions":["Set `ref` to a real branch, tag, or commit SHA (e.g. `ref = \"main\"`)","Remove the `ref` key entirely to use the remote's default branch","Fix the templating/variable so the ref value resolves non-empty"],"exampleFix":"// before\n\"~/src/dotfiles\" = { url = \"https://github.com/jdx/dotfiles.git\", ref = \"\" }\n// after\n\"~/src/dotfiles\" = { url = \"https://github.com/jdx/dotfiles.git\", ref = \"main\" }","handlingStrategy":"validation","validationCode":"function validateRef(entry) {\n  if ('ref' in entry && entry.ref.trim() === '') {\n    throw new Error('ref, when set, must be a non-empty branch/tag/SHA');\n  }\n}","typeGuard":"function hasValidRef(entry) {\n  return !('ref' in entry) || (typeof entry.ref === 'string' && entry.ref.trim().length > 0);\n}","tryCatchPattern":null,"preventionTips":["Omit `ref` instead of setting it to an empty string","When templating refs, validate the rendered value resolves to a real branch/tag","Keep default-branch checkouts ref-less"],"tags":["config","empty-value","git","bootstrap"],"backgroundTag":"empty-required-field","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"}