jdx/mise · error
task cache requires at least one source
Error message
task {} cache requires at least one source What it means
validate_config enforces that any task using artifact caching declares at least one source file. The cache key is derived from source inputs, so a task with no sources has nothing to fingerprint and cannot be cached safely. The task name is included in the message to pinpoint the offending config.
Solutions
- Add at least one source to the task, e.g. sources = ["src/**/*.ts"].
- If the task genuinely has no inputs, disable artifact caching for it.
- Check the task name in the message and fix the corresponding mise.toml entry.
- Run `mise tasks info <task>` to inspect the resolved task config.
Example fix
// before (mise.toml)
[tasks.build]
run = "vite build"
cache = { outputs = ["dist"] }
// after
[tasks.build]
run = "vite build"
sources = ["src/**/*"]
cache = { outputs = ["dist"] } Defensive patterns
Strategy: validation
Validate before calling
# shell: check task config before running
mise tasks info build | grep -q 'sources' || echo 'task build lacks sources'
# TOML: ensure at least one entry
assert len(task.get('sources', [])) > 0, 'caching task needs sources' Prevention
- Always pair cache-enabled tasks with a sources = [...] list
- Review tasks after refactors to confirm sources weren't dropped
- Validate task configs in CI with `mise tasks info`
When it happens
Trigger: Calling task cache setup/validate_config for a task whose `sources` list is empty (or unset) while caching is enabled for it (e.g. cache_experiment/cache settings apply to the task).
Common situations: Writing a mise.toml task with cache enabled but forgetting sources = [...]; a task whose sources were removed during refactoring; generated tasks that omit sources.
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
- task cache requires explicit outputs or outputs = []
- task cache command input must not be empty
- task cache outputs require at least one non-excluded pattern
- absent bootstrap group
- absent bootstrap user
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/9c892aede4799be9.
Report an issue: GitHub.
Appendix: source
Thrown at src/task/task_cache.rs:1203
display_cache_text(&crate::file::display_path(path))
}
fn display_cache_text(text: &str) -> String {
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
);View on GitHub (pinned to 533346cc37)