jdx/mise · error
{other:?}
Error message
{other:?} What it means
A test panic in src/system/history/journal.rs from a `match` on `PathSnapshot::capture_with`. The test expects the `File` variant (with a `content.size` of 7) for a regular file path; any other variant (`Missing`, `Directory`, `Symlink`, etc.) hits the catch-all `other => panic!("{other:?}")`. It indicates the path snapshotter classified a regular file as something else.
Source
Thrown at src/system/history/journal.rs:626
assert_eq!(std::fs::read(&on_disk).unwrap(), big);
// content-addressed: storing again is a no-op with the same id
let again = Blob::store_in(tmp.path(), &big).unwrap();
assert_eq!(again, stored);
}
#[test]
fn snapshots_capture_each_kind_of_path() {
let tmp = tempfile::tempdir().unwrap();
let state = tmp.path().join("state");
let file = tmp.path().join("file");
std::fs::write(&file, "content").unwrap();
assert!(matches!(
PathSnapshot::capture_with(&state, &tmp.path().join("nope"), Capture::Full),
PathSnapshot::Missing
));
match PathSnapshot::capture_with(&state, &file, Capture::Full) {
PathSnapshot::File { content, .. } => assert_eq!(content.size, 7),
other => panic!("{other:?}"),
}
#[cfg(unix)]
{
let link = tmp.path().join("link");
std::os::unix::fs::symlink("file", &link).unwrap();
assert!(matches!(
PathSnapshot::capture_with(&state, &link, Capture::Full),
PathSnapshot::Symlink { dest } if dest == Path::new("file")
));
nix::unistd::mkfifo(&tmp.path().join("fifo"), nix::sys::stat::Mode::S_IRWXU).unwrap();
assert!(matches!(
PathSnapshot::capture_with(&state, &tmp.path().join("fifo"), Capture::Full),
PathSnapshot::Unrecorded { .. }
));
}
let dir = tmp.path().join("dir/nested");
std::fs::create_dir_all(&dir).unwrap();
std::fs::write(dir.join("a"), "a").unwrap();View on GitHub (pinned to afd2eddd3a)
Solutions
- Verify the file exists and is a regular file at the exact path passed to `capture_with` before capture.
- Print the returned `PathSnapshot` variant in the catch-all to see the actual classification.
- Check `capture_with` metadata handling (file_type, symlink_follow) for regressions.
- Canonicalize temp paths if platform symlinked temp dirs change the observed file type.
Example fix
// before
match PathSnapshot::capture_with(&state, &file, Capture::Full) {
PathSnapshot::File { content, .. } => assert_eq!(content.size, 7),
other => panic!("{other:?}"),
}
// after
match PathSnapshot::capture_with(&state, &file, Capture::Full) {
PathSnapshot::File { content, .. } => assert_eq!(content.size, 7),
other => panic!("expected File snapshot for {file:?}, got {other:?}"),
} Defensive patterns
Strategy: validation
Validate before calling
// rust
let meta = std::fs::symlink_metadata(&file)?;
if !meta.is_file() {
return Err(format!("{} is not a regular file", file.display()));
} Type guard
fn as_file_snapshot(snap: &PathSnapshot) -> Option<&Content> {
match snap {
PathSnapshot::File { content, .. } => Some(content),
_ => None,
}
} Try / catch
// rust
match PathSnapshot::capture_with(&state, &path, Capture::Full) {
PathSnapshot::File { content, .. } => /* ... */,
other => return Err(anyhow!("expected File snapshot, got {other:?}")),
} Prevention
- Check path existence and type before capturing snapshots.
- Handle Missing and Symlink variants explicitly in callers.
- Canonicalize paths on platforms with symlinked temp dirs.
- Include the offending path and variant in diagnostics.
When it happens
Trigger: `PathSnapshot::capture_with(&state, &file, Capture::Full)` returning a non-`File` variant — e.g. the file does not exist at capture time (Missing), was replaced by a symlink/directory, or capture logic misclassifies the path.
Common situations: Test fixture not creating the file before capture; path resolution differences (relative vs absolute); changes to `capture_with` stat/metadata handling; symlinked temp directories (e.g. macOS /tmp) confusing type detection.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- rustc output is not a regular file: {}
- failed to create file symlink: {err}
- expected key file
- expected a checkpoint
- no baseline
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/0a61782cd3f47709.
Report an issue: GitHub.