{"record":{"id":"cf65fc6feb5f0fde","repo":"zed-industries/zed","slug":"a-file-not-a-skill-directory-already-exists-at","errorCode":null,"errorMessage":"A file (not a skill directory) already exists at {}. Delete it or pick a different skill name.","messagePattern":"A file \\(not a skill directory\\) already exists at (.+?)\\. Delete it or pick a different skill name\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/settings_ui/src/pages/skill_creator.rs","lineNumber":1213,"sourceCode":"    description: &str,\n    body: &str,\n    disable_model_invocation: bool,\n) -> Result<PathBuf> {\n    let skill_dir = skills_dir.join(name);\n    match fs.metadata(&skill_dir).await {\n        Ok(Some(metadata)) if metadata.is_dir => {\n            anyhow::bail!(\n                \"A skill named \\\"{name}\\\" already exists at {}. Pick a different name.\",\n                skill_dir.display()\n            );\n        }\n        Ok(Some(_)) => {\n            // Something exists at this path, but it isn't a directory — e.g.\n            // a stray file the user (or another tool) left there. Without\n            // this branch we'd fall through to `create_dir`, which on the\n            // real fs returns a generic \"File exists\" IO error that gives\n            // the user no idea what's wrong or how to recover.\n            anyhow::bail!(\n                \"A file (not a skill directory) already exists at {}. \\\n                 Delete it or pick a different skill name.\",\n                skill_dir.display()\n            );\n        }\n        Ok(None) => {}\n        Err(err) => {\n            return Err(err).with_context(|| {\n                format!(\n                    \"failed to check whether {} already exists\",\n                    skill_dir.display()\n                )\n            });\n        }\n    }\n\n    let content = format_skill_file(name, description, body, disable_model_invocation)?;\n","sourceCodeStart":1195,"sourceCodeEnd":1231,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/settings_ui/src/pages/skill_creator.rs#L1195-L1231","documentation":"Guard in write_skill_to_disk: something exists at the target path but it is a regular file, not a directory, so the skill directory cannot be created there. The error tells the user to delete the stray file or pick another name.","triggerScenarios":"Thrown at crates/settings_ui/src/pages/skill_creator.rs:1219 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Delete the stray file at the reported path and retry saving","Choose a different skill name that does not collide"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}