jdx/mise · error

task cache requires explicit outputs or outputs = []

Error message

task {} cache requires explicit outputs or outputs = []

What it means

A cacheable task must state its outputs explicitly: either a list of output patterns or an explicit empty list (outputs = []) meaning the task produces no artifacts worth caching. The special 'auto' outputs mode is rejected because cache correctness requires knowing exactly which paths to archive and restore.

Solutions

  1. Declare explicit outputs in the task config, e.g. outputs = ["dist"] (glob patterns allowed).
  2. If the task produces no files, set outputs = [] explicitly.
  3. Check the named task's mise.toml block and remove reliance on auto outputs.
  4. Use `mise tasks info <task>` to confirm the outputs configuration was picked up.

Example fix

// before (mise.toml)
[tasks.build]
run = "vite build"
sources = ["src/**/*"]
// after
[tasks.build]
run = "vite build"
sources = ["src/**/*"]
outputs = ["dist"]   # or outputs = [] if there are none
Defensive patterns

Strategy: validation

Validate before calling

const outputs = task.outputs;
if (outputs == null || outputs === 'auto') throw new Error('declare outputs explicitly, or outputs = []');

Type guard

function hasExplicitOutputs(t: { outputs?: string[] | 'auto' }): t is { outputs: string[] } {
  return Array.isArray(t.outputs);
}

Prevention

When it happens

Trigger: validate_config for a task where task.outputs.is_auto() is true — i.e. the task relies on default/auto output discovery while artifact caching is enabled, instead of declaring outputs in mise.toml.

Common situations: Copying a task definition that previously ran without caching and enabling cache on it; omitting the outputs key expecting mise to infer it; template-generated tasks that never set outputs.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/07b1f6aa4e6ebeb8. Report an issue: GitHub.

Appendix: source

Thrown at src/task/task_cache.rs:1207

    text.escape_debug().to_string()
}

/// Returns the versioned directory containing task artifact cache entries.
pub(crate) fn task_cache_dir() -> PathBuf {
    Settings::get()
        .task
        .cache_dir
        .clone()
        .unwrap_or_else(|| dirs::CACHE.join("task-artifacts"))
        .join(CACHE_DIR_VERSION)
}

pub(crate) fn validate_config(task: &Task, root: &Path) -> Result<()> {
    if task.sources.is_empty() {
        bail!("task {} cache requires at least one source", task.name);
    }
    if task.outputs.is_auto() {
        bail!(
            "task {} cache requires explicit outputs or outputs = []",
            task.name
        );
    }
    if let Some(command) = task.cache.as_ref().and_then(|cache| {
        cache
            .command_inputs
            .iter()
            .find(|command| command.trim().is_empty())
    }) {
        bail!(
            "task {} cache command input must not be empty: {command:?}",
            task.name
        );
    }
    let patterns = task.outputs.patterns();
    if !patterns.is_empty() && output_glob_patterns(&patterns).is_empty() {
        bail!(

View on GitHub (pinned to 533346cc37)