{"record":{"id":"af80e2905ff2e395","repo":"jdx/mise","slug":"task-includes-do-not-contain-an-existing-directory","errorCode":null,"errorMessage":"task includes do not contain an existing directory where a file task can be created","messagePattern":"task includes do not contain an existing directory where a file task can be created","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/config/mod.rs","lineNumber":5398,"sourceCode":"    let default_create_dir = if uses_defaults {\n        includes\n            .first()\n            .map(|include| resolve_dir.join(file::replace_path(include)))\n    } else {\n        None\n    };\n    if let Some(path) = includes\n        .iter()\n        .filter(|include| !include.starts_with(\"git::\"))\n        .flat_map(|include| expand_task_include(&resolve_dir, include))\n        .find(|path| path.is_dir())\n    {\n        return Ok(path);\n    }\n    if let Some(dir) = default_create_dir {\n        return Ok(dir);\n    }\n    bail!(\"task includes do not contain an existing directory where a file task can be created\")\n}\n\npub(crate) async fn load_tasks_in_dir(\n    config: &Arc<Config>,\n    dir: &Path,\n    config_files: &ConfigMap,\n) -> Result<Vec<Task>> {\n    let workspace_graph = (Settings::get().experimental && config.monorepo_root().is_some())\n        .then(|| config.workspace_project_graph_for_task_loading());\n    let definitions = collect_task_definitions(\n        config_files,\n        workspace_graph\n            .as_ref()\n            .and_then(|graph| graph.as_ref().ok())\n            .map(Arc::as_ref),\n    );\n    load_tasks_in_dir_with_definitions(config, dir, config_files, &definitions).await\n}","sourceCodeStart":5380,"sourceCodeEnd":5416,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/config/mod.rs#L5380-L5416","documentation":"When loading task includes, mise needs a directory in which a file-based task can be created/registered, but none of the included paths contain an existing directory and no default create directory was supplied.","triggerScenarios":"Resolving a task include whose target does not yield an existing path and for which default_create_dir is None — include globs match nothing on disk, so there is no directory to anchor file tasks.","commonSituations":"Task includes pointing at directories that don't exist (yet), typo'd include globs, or include paths relative to a config whose base directory differs from expected; often after cloning a repo without submodules or before a generated directory exists.","solutions":["Ensure the include path/glob points at an existing directory containing task files","Check the path is relative to the correct config file location","Create the directory (or generate task files) before loading, or remove the include","If submodules provide the tasks, run `git submodule update --init`"],"exampleFix":"# before (.mise/tasks referenced but missing)\nincludes = [\".mise/tasks\"]\n# after: create the directory or fix the path\nincludes = [\"tasks\"] # where ./tasks exists in the config's directory","handlingStrategy":"validation","validationCode":"# shell: ensure task include directories exist before invoking mise\nfor d in .mise/tasks tasks; do\n  [ -d \"$d\" ] || echo \"include dir missing: $d\"\ndone","typeGuard":"// Rust\nfn include_dir_exists(base: &Path, inc: &str) -> bool {\n    base.join(inc).is_dir()\n}","tryCatchPattern":"// Rust\nmatch load_tasks(config).await {\n    Ok(tasks) => use(tasks),\n    Err(e) if e.to_string().contains(\"existing directory where a file task can be created\") => {\n        eprintln!(\"create the include directory or fix the include path\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Commit task directories (don't rely on generated dirs) or generate them before mise runs","Initialize git submodules that supply task files after cloning","Verify include paths are relative to the declaring config file's directory"],"tags":["task","include","directory","file-not-found"],"backgroundTag":"directory-not-found","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"}