{"record":{"id":"3318f5a374c45638","repo":"jdx/mise","slug":"task-cache-outputs-require-at-least-one-non-exc","errorCode":null,"errorMessage":"task {} cache outputs require at least one non-excluded pattern","messagePattern":"task (.+?) cache outputs require at least one non-excluded pattern","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/task/task_cache.rs","lineNumber":1223,"sourceCode":"    }\n    if task.outputs.is_auto() {\n        bail!(\n            \"task {} cache requires explicit outputs or outputs = []\",\n            task.name\n        );\n    }\n    if let Some(command) = task.cache.as_ref().and_then(|cache| {\n        cache\n            .command_inputs\n            .iter()\n            .find(|command| command.trim().is_empty())\n    }) {\n        bail!(\n            \"task {} cache command input must not be empty: {command:?}\",\n            task.name\n        );\n    }\n    let patterns = task.outputs.patterns();\n    if !patterns.is_empty() && output_glob_patterns(&patterns).is_empty() {\n        bail!(\n            \"task {} cache outputs require at least one non-excluded pattern\",\n            task.name\n        );\n    }\n    for output in &patterns {\n        let path = if let Some(body) = output.strip_prefix('!') {\n            PathBuf::from(body)\n        } else if let Some(body) = output.strip_prefix(\"\\\\!\") {\n            PathBuf::from(format!(\"!{body}\"))\n        } else {\n            PathBuf::from(&output)\n        };\n        ensure_safe_relative(&path).wrap_err_with(|| {\n            format!(\n                \"task {} cache output must stay within {}: {output}\",\n                task.name,","sourceCodeStart":1205,"sourceCodeEnd":1241,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/task/task_cache.rs#L1205-L1241","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add at least one inclusion pattern to outputs, e.g. outputs = [\"dist\", \"!dist/tmp\"].","If the task has no outputs, use outputs = [] instead of only exclusion patterns.","Check the named task's mise.toml block for negated ('!') patterns dominating the list.","Use `mise tasks info <task>` to confirm the resolved output patterns."],"exampleFix":"// before (mise.toml)\noutputs = [\"!node_modules\", \"!coverage\"]\n// after\noutputs = [\"dist\", \"!node_modules\", \"!coverage\"]","handlingStrategy":"validation","validationCode":"const pats = task.outputs as string[];\nconst positive = pats.filter(p => !p.startsWith('!'));\nif (pats.length > 0 && positive.length === 0) throw new Error('outputs need at least one non-excluded pattern');","typeGuard":"function hasInclusionPattern(outputs: string[]): boolean {\n  return outputs.filter(p => !p.startsWith('!')).length > 0;\n}","tryCatchPattern":null,"preventionTips":["Keep at least one positive (non-'!') output pattern per task","Use outputs = [] for tasks with no artifacts instead of only exclusions","Review outputs lists when adding exclusion patterns"],"tags":["task-cache","config-validation","glob-patterns"],"backgroundTag":"invalid-config-value","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"}