jdx/mise · error · eyre::Report

task includes do not contain an existing directory where a f

Error message

task includes do not contain an existing directory where a file task can be created

What it means

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.

Source

Thrown at src/config/mod.rs:4337

    let default_create_dir = if uses_defaults {
        includes
            .first()
            .map(|include| resolve_dir.join(file::replace_path(include)))
    } else {
        None
    };
    if let Some(path) = includes
        .iter()
        .filter(|include| !include.starts_with("git::"))
        .flat_map(|include| expand_task_include(&resolve_dir, include))
        .find(|path| path.is_dir())
    {
        return Ok(path);
    }
    if let Some(dir) = default_create_dir {
        return Ok(dir);
    }
    bail!("task includes do not contain an existing directory where a file task can be created")
}

pub async fn load_tasks_in_dir(
    config: &Arc<Config>,
    dir: &Path,
    config_files: &ConfigMap,
) -> Result<Vec<Task>> {
    let workspace_graph = (Settings::get().experimental && config.monorepo_root().is_some())
        .then(|| config.workspace_project_graph_for_task_loading());
    let definitions = collect_task_definitions(
        config_files,
        workspace_graph
            .as_ref()
            .and_then(|graph| graph.as_ref().ok())
            .map(Arc::as_ref),
    );
    load_tasks_in_dir_with_definitions(config, dir, config_files, &definitions).await
}

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. Create the directory your includes reference so at least one include is an existing dir: `mkdir -p tasks`
  2. Fix or add an `includes` entry in mise.toml that points at an existing directory
  3. If includes are intentionally remote-only, pass/uses a default creation directory instead of relying on includes

Example fix

# before
includes = ["tasks"]   # tasks/ does not exist
# after (either works)
mkdir -p tasks
# or in mise.toml:
includes = [".mise/tasks"]  # an existing directory
Defensive patterns

Strategy: validation

Validate before calling

# before running task creation, ensure at least one local include dir exists
mise config ls 2>/dev/null | true
grep -oP '^includes\s*=\s*\[.*\]' mise.toml || true
for d in tasks .mise/tasks; do
  [ -d "$d" ] && echo "creatable in: $d" && exit 0
done
echo "no existing include directory — mkdir -p tasks first" && exit 1

Prevention

When it happens

Trigger: 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.

Common situations: `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.

Related errors


AI-assisted analysis of jdx/mise@9dcfcaa0dc (2026-08-17). Data as JSON: /api/errors/af80e2905ff2e395. Report an issue: GitHub.