jdx/mise · error
watch_files command failed
Error message
watch_files command failed: {status} What it means
This error is thrown in the watch_files command executor when a spawned subprocess (the file-watching command) exits with a non-zero status. The command is run with a cleared environment plus explicitly passed env vars and stdout redirected to stderr. It signals that the watcher process itself failed, not that mise failed to spawn it.
Solutions
- Run the watch command manually with the same arguments to see its actual error output (stdout/stderr is forwarded to stderr)
- Fix the arguments or configuration of the underlying watch command so it exits 0
- Check that the env vars being forwarded are correct and that env_clear is not dropping vars the watcher needs
- Verify the target tool/binary the watcher invokes is installed and on PATH
Example fix
// before mise watch --bad-flag src // after mise watch --correct-flag src
Defensive patterns
Strategy: try-catch
Validate before calling
// verify the watch command exits cleanly before relying on it mise watch --dry-run src || echo "watch command itself fails"
Try / catch
match result {
Err(e) if e.to_string().contains("watch_files command failed") => {
eprintln!("watcher exited non-zero; rerun the command manually to see its error");
}
Err(e) => return Err(e),
Ok(v) => v,
} Prevention
- Smoke-test the watch command manually after changing its arguments
- Keep forwarded env vars minimal and documented
- Ensure the watched tool is installed and on PATH
- Check exit codes of the watcher in CI
When it happens
Trigger: The child process spawned in `execute` returns a failing exit status from `c.status()`; any invocation of the watch_files inline command whose underlying watcher binary or script exits non-zero.
Common situations: The watch command crashes on invalid arguments, the watched tool binary is missing or misconfigured, environment variables passed to the watcher are wrong, or the watcher is killed and reports a non-zero code.
Understand the failure class
Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.
Related errors
- failed
- querying scheduled task
- apk failed while installing OCI system packages
- apt-get failed while installing OCI system packages
- get failed for
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/6c4a8724390c04a1.
Report an issue: GitHub.
Appendix: source
Thrown at src/watch_files.rs:128
"MISE_PROJECT_ROOT".to_string(),
root.to_string_lossy().to_string(),
);
// TODO: this should be different but I don't have easy access to it
// env.insert("MISE_CONFIG_ROOT".to_string(), root.to_string_lossy().to_string());
// On Windows, `cmd /c <run>` must receive the command verbatim so inner
// double quotes survive (#9355). Mirror the hook path: spawn a raw Command
// with stdout redirected to our stderr handle (duct's stdout_to_stderr) and
// the full env. Non-cmd shells / Unix fall through to the duct path below.
#[cfg(windows)]
{
if let Some(mut c) = crate::path::cmd_verbatim_command(program, shell_args, run) {
use std::os::windows::io::AsHandle;
c.env_clear();
c.envs(env.iter());
c.stdout(std::io::stderr().as_handle().try_clone_to_owned()?);
let status = c.status()?;
if !status.success() {
eyre::bail!("watch_files command failed: {status}");
}
return Ok(());
}
}
crate::inline_command::optimize_expression(
cmd(program, args).full_env(&env),
run,
&env,
None,
direct_enabled,
)
.stdout_to_stderr()
.run()?;
Ok(())
}
async fn execute_task(
config: &Arc<Config>,View on GitHub (pinned to 533346cc37)