{"record":{"id":"e2db085d68d30b07","repo":"jdx/mise","slug":"files-entries-with-errors","errorCode":null,"errorMessage":"files: entries with errors:\n{}","messagePattern":"files: entries with errors:\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/files.rs","lineNumber":1721,"sourceCode":"}\n\n/// Render every configured dotfile template before a full bootstrap can\n/// mutate anything. Secret values are cached, but templates are rendered again\n/// when applied so hooks can update dynamic inputs such as files or commands.\npub(crate) fn preflight_templates(\n    config: &Config,\n    requests: &[FileRequest],\n    secrets: &SecretValues,\n) -> Result<()> {\n    validate_composed_file_footprints(requests)?;\n    let broken = requests\n        .iter()\n        .filter(|req| req.mode == FileMode::Template)\n        .filter_map(|req| render_template(config, req, secrets).err())\n        .map(|err| format!(\"  {err}\"))\n        .collect::<Vec<_>>();\n    if !broken.is_empty() {\n        bail!(\"files: entries with errors:\\n{}\", broken.join(\"\\n\"));\n    }\n    Ok(())\n}\n\n/// directories a symlink-each entry needs: the target itself plus every\n/// intermediate directory for nested source files\nfn needed_dirs(req: &FileRequest) -> Result<Vec<PathBuf>> {\n    let mut out = indexmap::IndexSet::new();\n    out.insert(req.target.clone());\n    for (_, target) in walk_source_files(req)? {\n        let mut dir = target.parent();\n        while let Some(d) = dir {\n            if d == req.target {\n                break;\n            }\n            out.insert(d.to_path_buf());\n            dir = d.parent();\n        }","sourceCodeStart":1703,"sourceCodeEnd":1739,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/files.rs#L1703-L1739","documentation":"Before applying dotfiles, mise renders every `template`-mode entry; if any render fails, it collects all errors and bails with a single aggregated 'files: entries with errors' listing each failure. This gives one report of every broken template instead of failing on the first.","triggerScenarios":"Running dotfile apply/status where one or more `mode = \"template\"` entries fail render_template — undefined variables, bad template syntax, missing secrets referenced in the template.","commonSituations":"A template references a secret that is not set; Tera/Jinja syntax error after editing; variable renamed in a newer config; template depends on machine-specific context absent on a new host.","solutions":["Read each listed sub-error and fix the corresponding template (syntax, variables).","Define the missing variables/secrets the template references.","Change problematic entries from template mode to plain copy if templating is not needed."],"exampleFix":"// before\n\"~/.gitconfig\" = { source = \"gitconfig.tmpl\", mode = \"template\" } // uses {{ email }} which is unset\n// after (config)\n[files.env]\nemail = \"me@example.com\"\n// or fix the .tmpl file's syntax/variable name","handlingStrategy":"try-catch","validationCode":"// Render each template locally before apply:\nfor (target, entry) in template_entries {\n    render_template(&config, entry, &secrets)\n        .unwrap_or_else(|e| eprintln!(\"{target}: {e}\"));\n}","typeGuard":null,"tryCatchPattern":"match dotfiles_apply() {\n    Err(e) if e.to_string().starts_with(\"files: entries with errors:\") => {\n        for line in e.to_string().lines().skip(1) { eprintln!(\"fix: {line}\"); }\n    }\n    other => other?,\n}","preventionTips":["Keep template variables defined in the same config file that uses them.","Set required secrets before running apply.","Preview renders with status/dry-run before applying."],"tags":["dotfiles","templates","mise"],"backgroundTag":"template-render-failed","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"}