{"record":{"id":"8bfe6b5aef3463d2","repo":"jdx/mise","slug":"task-cache-outputs-must-not-contain-source","errorCode":null,"errorMessage":"task {} cache outputs must not contain source {}","messagePattern":"task (.+?) cache outputs must not contain source (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/task/task_cache.rs","lineNumber":280,"sourceCode":"    ) -> Result<Option<TaskArtifactCacheBuilder>> {\n        Settings::get().ensure_experimental(\"task artifact caching\")?;\n        let root = task_cwd(task, config).await?;\n        validate_config(task, &root)?;\n        let output_roots = resolve_output_roots(task, &root, false)?;\n        for output in &output_roots {\n            ensure_no_symlink_ancestors(&root, output)?;\n        }\n        let Some(inputs) = task_cache_inputs(task, config, !dry_run).await? else {\n            warn!(\n                \"task {} has sources defined but no matching files found; artifact caching disabled\",\n                task.name\n            );\n            return Ok(None);\n        };\n        for source in &inputs.source_paths {\n            if output_roots\n                .iter()\n                .any(|output| source == output || source.starts_with(output))\n            {\n                bail!(\n                    \"task {} cache outputs must not contain source {}\",\n                    task.name,\n                    source.display()\n                );\n            }\n        }\n        Ok(Some(TaskArtifactCacheBuilder {\n            root,\n            inputs,\n            output_roots,\n        }))\n    }\n}\n\nimpl TaskArtifactCacheBuilder {\n    /// Finishes cache-key construction after task tools, environment, and","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/task/task_cache.rs#L262-L298","documentation":"For cacheable tasks, mise validates that no cache output directory overlaps (equals or is a parent path of) any declared source input path. Outputs containing sources would make cache hits skip rebuilding files that should be tracked as inputs, so the config is rejected before caching proceeds.","triggerScenarios":"Declaring a task whose `outputs` include a directory that is also listed in `sources` (or an ancestor of one), e.g. outputs=[\"dist\"] with sources=[\"dist/generated\"] or sources=[\"src\", \"dist\"].","commonSituations":"Generated-code setups where generated files live under the same directory declared as an output while sources point into it; mis-typed paths making outputs accidentally enclose sources.","solutions":["Remove the overlapping source path from `sources`, or shrink `outputs` so it doesn't contain the source","Move generated files to a directory separate from declared sources (e.g. outputs=[\"gen\"], sources=[\"src\"])","Re-run the task after adjusting the config to confirm caching works"],"exampleFix":"// before\n[tasks.gen]\nsources = [\"src\", \"dist\"]\noutputs = [\"dist\"]\n\n// after\n[tasks.gen]\nsources = [\"src\"]\noutputs = [\"dist\"]","handlingStrategy":"validation","validationCode":"# fail fast if any source path sits inside an output path\ngrep -n \"sources\\|outputs\" mise.toml | head -20  # then eyeball for nested overlaps","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep source and output directories disjoint by convention (src/ vs dist/)","Never declare a generated subdirectory as a source if its parent is an output","Review task cache config whenever you change output directory layouts"],"tags":["tasks","cache","config","validation"],"backgroundTag":"conflicting-config-options","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"}