jdx/mise · error

task cache outputs require at least one non-excluded pattern

Error message

task {} cache outputs require at least one non-excluded pattern

What it means

A task's outputs may contain exclusion patterns (e.g. patterns beginning with '!'), but the resulting set must still contain at least one inclusion pattern; otherwise there would be nothing to archive. validate_config checks this by running output_glob_patterns over task.outputs.patterns() and bailing if it filters down to an empty set while patterns were declared.

Solutions

  1. Add at least one inclusion pattern to outputs, e.g. outputs = ["dist", "!dist/tmp"].
  2. If the task has no outputs, use outputs = [] instead of only exclusion patterns.
  3. Check the named task's mise.toml block for negated ('!') patterns dominating the list.
  4. Use `mise tasks info <task>` to confirm the resolved output patterns.

Example fix

// before (mise.toml)
outputs = ["!node_modules", "!coverage"]
// after
outputs = ["dist", "!node_modules", "!coverage"]
Defensive patterns

Strategy: validation

Validate before calling

const pats = task.outputs as string[];
const positive = pats.filter(p => !p.startsWith('!'));
if (pats.length > 0 && positive.length === 0) throw new Error('outputs need at least one non-excluded pattern');

Type guard

function hasInclusionPattern(outputs: string[]): boolean {
  return outputs.filter(p => !p.startsWith('!')).length > 0;
}

Prevention

When it happens

Trigger: validate_config for a task whose outputs.patterns() is non-empty but output_glob_patterns(patterns) returns empty — i.e. every declared pattern is an exclusion/negated pattern (or otherwise filtered out), leaving zero positive patterns.

Common situations: Writing outputs = ["!node_modules", "!logs"] with no positive pattern; refactoring outputs and accidentally deleting the inclusion entries while keeping exclusions; templated outputs where all positive patterns resolve away.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at src/task/task_cache.rs:1223

    }
    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!(
            "task {} cache outputs require at least one non-excluded pattern",
            task.name
        );
    }
    for output in &patterns {
        let path = if let Some(body) = output.strip_prefix('!') {
            PathBuf::from(body)
        } else if let Some(body) = output.strip_prefix("\\!") {
            PathBuf::from(format!("!{body}"))
        } else {
            PathBuf::from(&output)
        };
        ensure_safe_relative(&path).wrap_err_with(|| {
            format!(
                "task {} cache output must stay within {}: {output}",
                task.name,

View on GitHub (pinned to 533346cc37)