{"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":"validation","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/config/mod.rs","lineNumber":4337,"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 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":4319,"sourceCodeEnd":4355,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/config/mod.rs#L4319-L4355","documentation":"When mise needs to create a new file task, it chooses a directory: the first non-`git::` include that expands (via `expand_task_include`) to a path that `is_dir()`, otherwise `default_create_dir`. If every include is a remote `git::` URL or a local path that does not exist on disk, and no default creation dir was supplied, there is no safe place to write the task file, so the helper bails.","triggerScenarios":"File-task creation (e.g. `mise task new`) in a project whose `includes` list has no existing directory: paths that were never created, point to files, use variables that expand to missing locations, or are all `git::` remotes — and no default_create_dir fallback.","commonSituations":"`includes = [\"tasks\"]` in mise.toml but the `tasks/` directory was never committed/created; repos cloned without untracked task dirs; remote-only include setups where the user then tries to create a local file task; include paths with `{{…}}` templating that expands differently at creation time.","solutions":["Create the directory your includes reference so at least one include is an existing dir: `mkdir -p tasks`","Fix or add an `includes` entry in mise.toml that points at an existing directory","If includes are intentionally remote-only, pass/uses a default creation directory instead of relying on includes"],"exampleFix":"# before\nincludes = [\"tasks\"]   # tasks/ does not exist\n# after (either works)\nmkdir -p tasks\n# or in mise.toml:\nincludes = [\".mise/tasks\"]  # an existing directory","handlingStrategy":"validation","validationCode":"# before running task creation, ensure at least one local include dir exists\nmise config ls 2>/dev/null | true\ngrep -oP '^includes\\s*=\\s*\\[.*\\]' mise.toml || true\nfor d in tasks .mise/tasks; do\n  [ -d \"$d\" ] && echo \"creatable in: $d\" && exit 0\ndone\necho \"no existing include directory — mkdir -p tasks first\" && exit 1","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Commit an empty `.gitkeep` inside your task include directories so clones always have them","Avoid remote-only (`git::`) includes if you plan to create file tasks locally","Run `mise task new` once in CI to verify the project provides a valid creation dir"],"tags":["mise","task","config","filesystem","includes"],"backgroundTag":"missing-directory","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}