{"record":{"id":"40369e65825d9dcd","repo":"jdx/mise","slug":"mode-symlink-each-requires-the-source-to-be-a-dire-40369e","errorCode":null,"errorMessage":"mode symlink-each requires the source to be a directory","messagePattern":"mode symlink-each requires the source to be a directory","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/files.rs","lineNumber":2819,"sourceCode":"                req.target.display_user()\n            );\n            return Ok(None);\n        }\n        FileMode::Content => {\n            if !req.target.exists() && !req.target.is_symlink() {\n                return Ok(None);\n            }\n            if opts.force {\n                paths.insert(req.target.clone(), ());\n            } else {\n                plan_inline_file(req, &mut paths)?;\n            }\n        }\n        FileMode::Symlink => {\n            plan_single_file(req, opts, &mut paths)?;\n        }\n        FileMode::SymlinkEach => {\n            bail!(\"mode symlink-each requires the source to be a directory\");\n        }\n        FileMode::Template => {\n            if !req.target.exists() && !req.target.is_symlink() {\n                return Ok(None);\n            }\n            if opts.force {\n                paths.insert(req.target.clone(), ());\n            } else if opts.dry_run {\n                // Rendering may execute commands. Keep dry-run inert, matching\n                // apply/status policy, and describe the removal as conditional.\n                paths.insert(req.target.clone(), ());\n                conditional = true;\n            } else {\n                if !req.source.exists() {\n                    bail!(\"source is missing; use --force to remove the target\");\n                }\n                // Rendering may execute user-authored commands. Defer it until\n                // after the complete unapply plan has been confirmed.","sourceCodeStart":2801,"sourceCodeEnd":2837,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/files.rs#L2801-L2837","documentation":"The file-management (dotfiles) subsystem's `symlink-each` mode links each entry inside a source directory individually into the target. This error is thrown during unapply planning when `SymlinkEach` is reached even though the request's source is not a directory (the directory case is handled earlier; reaching this arm means the source was missing or not a directory). The library refuses to guess what set of files the mode would have managed, so it aborts.","triggerScenarios":"Calling the files unapply/plan flow with `FileMode::SymlinkEach` while `req.source` is not an existing directory — e.g. the source directory was deleted/renamed/moved before unapply, or the mode was set on a single-file source.","commonSituations":"A user renamed their dotfiles repo directory, checked out a branch where the directory no longer exists, or typo'd the `source` path in mise.toml while using `symlink-each` mode, then ran `mise files unapply` or `mise files status`.","solutions":["Restore the source directory (git checkout / correct path) so symlink-each has a directory to enumerate","Fix the `source` path in the file entry config to point at an existing directory","If only a single file should be linked, change the entry mode to `symlink`","Remove or comment out the stale file entry if it is no longer needed"],"exampleFix":"// before (mise.toml)\n[[files]]\nmode = \"symlink-each\"\nsource = \"~/.dotfiles/nvim\"\ntarget = \"~/.config/nvim\"\n\n// after — path corrected to the real directory\n[[files]]\nmode = \"symlink-each\"\nsource = \"~/dotfiles/config/nvim\"\ntarget = \"~/.config/nvim\"","handlingStrategy":"validation","validationCode":"if !source.is_dir() {\n    return Err(format!(\"symlink-each needs a directory source; '{}' is missing or not a directory\", source.display()));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify the source directory exists before configuring symlink-each mode","Use mode `symlink` for single-file entries","Check the source path again after branch switches or repo moves"],"tags":["dotfiles","symlink","invalid-state"],"backgroundTag":"path-is-not-a-directory","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"}