jdx/mise · warning

watch file no longer exists

Error message

watch file no longer exists: {}

What it means

During env-cache validation, a watched file listed in the cache (that had a nonzero mtime when cached) no longer exists on disk. Since the environment derived from that file may no longer be valid, `load` bails and the cache is treated as stale.

Solutions

  1. Restore the missing file (e.g. `git checkout -- <file>`) or accept the invalidation.
  2. Clear the env cache and re-run so it rebuilds against current files.
  3. If the file is intentionally gone, re-run the mise command — a fresh cache entry will exclude it.
  4. Check whether a branch switch or tool run deleted the file.

Example fix

// before
git status  # .env missing
// after
git checkout -- .env  # or delete stale cache and re-run
Defensive patterns

Strategy: fallback

Validate before calling

if watch_files.iter().any(|p| !p.exists()) { /* rebuild cache */ }

Try / catch

match env_cache::load(...) { Err(e) if e.to_string().contains("no longer exists") => recompute_env(), other => other? }

Prevention

When it happens

Trigger: Calling `load` where a watch file with a nonzero expected_mtime is missing: the file was deleted/moved between caching and now, and expected_mtime != 0.

Common situations: A dotenv/config file watched by the cache was deleted, a git checkout removed a file, or a project directory was cleaned.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/50876de85751e675. Report an issue: GitHub.

Appendix: source

Thrown at src/toolset/env_cache.rs:69

        .map_err(|e| eyre::eyre!("failed to create cipher: {}", e))?;

    let plaintext = cipher
        .decrypt(&nonce, ciphertext)
        .map_err(|e| eyre::eyre!("decryption failed: {}", e))?;
    Ok(plaintext)
}

fn validate_watch_files(watch_files: &[PathBuf], expected_mtimes: &[u64]) -> Result<()> {
    if watch_files.len() != expected_mtimes.len() {
        bail!("watch file count mismatch");
    }
    for (path, expected_mtime) in watch_files.iter().zip(expected_mtimes.iter()) {
        if !path.exists() {
            // mtime=0 means file didn't exist when cached - skip if still doesn't exist
            if *expected_mtime == 0 {
                continue;
            }
            bail!("watch file no longer exists: {}", path.display());
        }
        if let Some(current_mtime) = get_file_mtime(path) {
            if current_mtime != *expected_mtime {
                bail!(
                    "watch file mtime changed: {} (expected: {}, current: {})",
                    path.display(),
                    expected_mtime,
                    current_mtime
                );
            }
        } else {
            bail!("could not get mtime for watch file: {}", path.display());
        }
    }
    Ok(())
}

/// Represents the cached environment data

View on GitHub (pinned to 533346cc37)