jdx/mise · error
task cache command input must not be empty
Error message
task {} cache command input must not be empty: {command:?} What it means
Before replaying a cached task, mise validates each recorded command input; a command whose trimmed content is empty (empty string or whitespace only) cannot be executed or hashed meaningfully, so the executor bails naming the task and the offending command. This indicates corrupted or improperly recorded cache metadata.
Solutions
- Clear the task's cached entry (e.g. `mise cache` cleanup or removing the task cache dir) and re-run the task to rebuild valid metadata.
- Fix the task definition so the command string is non-empty — check template expressions and env-driven command construction.
- Find and fix the producer that wrote an empty command_inputs entry into the cache.
- Guard templated commands with a fallback/default so they can never evaluate to an empty string.
Example fix
// before (mise.toml): template collapses to empty
run = "{{env.OPTIONAL_CMD}}"
// after: provide a non-empty fallback
run = "{{env.OPTIONAL_CMD ?? echo skipping}}" Defensive patterns
Strategy: validation
Validate before calling
const cmds = cache.commandInputs ?? [];
if (cmds.some(c => !c || !c.trim())) throw new Error('cache metadata contains an empty command input'); Type guard
const nonEmptyCmd = (c) => typeof c === 'string' && c.trim().length > 0;
Try / catch
try {
await runCached(task);
} catch (e) {
if (String(e).includes('cache command input must not be empty')) {
clearTaskCache(task.name);
await runCached(task);
} else throw e;
} Prevention
- Give templated commands non-empty defaults so they never resolve to ''.
- Clear stale cache entries after editing task definitions.
- Reject blank command strings when writing cache metadata.
When it happens
Trigger: Replaying a task cache whose command_inputs list contains an empty or whitespace-only string — e.g. cache metadata written by a producer that recorded blank commands, or hand-edited/corrupted cache files.
Common situations: Task definitions whose command resolved to an empty string due to templating failures or misconfigured env; corrupted local cache files; manually edited or programmatically generated cache metadata with blank entries.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- invalid remote task cache key
- path must identify an output beneath the task directory
- path must not escape the task directory
- remote cache directory contains duplicate names
- task cache archive contains duplicate paths
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/6fe6f35bf57793f2.
Report an issue: GitHub.
Appendix: source
Thrown at src/task/task_executor.rs:1426
sandbox.filter_env(resolved_env)
} else {
resolved_env.clone()
};
let timeout = task
.timeout
.as_ref()
.and_then(|value| match duration::parse_duration(value) {
Ok(timeout) => Some(timeout),
Err(err) => {
warn!("invalid timeout {:?} for task {}: {err}", value, task.name);
None
}
})
.unwrap_or(COMMAND_INPUT_TIMEOUT);
let mut inputs = Vec::with_capacity(cache.command_inputs.len());
for command in &cache.command_inputs {
if command.trim().is_empty() {
eyre::bail!(
"task {} cache command input must not be empty: {command:?}",
task.name
);
}
let (program, args, cmd_verbatim) =
self.get_cmd_program_and_args(command, task, &[])?;
// The same refusal as in `exec_program`, and it matters more here: these commands feed
// the cache key, so running them from C:\Windows would hash the wrong directory's
// answer. Measured on 2026.8.6 with the project on a UNC share — a `command_inputs`
// entry reading a file that exists in the project fails, while the same config on a
// local path succeeds. `--dry-run` does not reach here (see the cache branch in
// `run_task`), so there is nothing to exempt.
#[cfg(windows)]
if cmd_shell_cannot_use_dir(&program, &root) {
eyre::bail!("{}", unc_working_dir_error(&root));
}
#[cfg(not(windows))]
let _ = cmd_verbatim;View on GitHub (pinned to 533346cc37)