AprilNEA/OpenLogi · error

relationship verification failed: cassette file

Error message

relationship verification failed: cassette file {file_name:?} contains case {:?}

What it means

During fixture relationship verification, a cassette JSON file present in the fixture directory was read successfully, but its internal `name` field does not match the case name declared in the fixture manifest. The verifier requires each cassette file's embedded case name to agree exactly with the manifest's declaration for that file. This catches renamed cases whose on-disk files were not regenerated in step.

Solutions

  1. Open the cassette JSON at the reported file path and set its `name` field to the case name declared in the fixture manifest.
  2. Regenerate the cassette files with the fixture authoring/record tooling so names and files are rewritten together.
  3. If the case name in the manifest is wrong, update the manifest entry (and its directory id if needed) to match the cassette's actual name.
  4. Re-run `openlogi fixture verify` to confirm the corpus is consistent.

Example fix

// before (case.json)
{ "name": "bolt-smartshift-old", ... }
// after
{ "name": "bolt-smartshift", ... }
Defensive patterns

Strategy: validation

Validate before calling

let cassette: serde_json::Value = serde_json::from_str(&std::fs::read_to_string(path)?)?;
let name = cassette["name"].as_str().ok_or("cassette missing name")?;
assert_eq!(name, expected_case_name, "cassette name {name} != manifest case {expected_case_name}");

Prevention

When it happens

Trigger: Running `openlogi fixture verify` (via `load_cassettes`, called from `load`) when a `*.json` HID cassette in the fixture directory declares a `name` that differs from the manifest case mapped to that filename by `case_file_name` (e.g. the manifest entry was renamed but the cassette JSON still carries the old name).

Common situations: A developer renames a fixture case in the manifest (or in code that generates it) without editing the cassette file's `name` field; hand-edited cassettes copied from another fixture; a merge kept the new filename with the old file content.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of AprilNEA/OpenLogi@e846e6f4b4 (2026-09-13). Data as JSON: /api/errors/33e1748aa03b3c4a. Report an issue: GitHub.

Appendix: source

Thrown at crates/openlogi-cli/src/cmd/fixture/verify.rs:156

                "relationship verification failed: profile-only fixture has an undeclared cases directory"
            );
        }
        return Ok(Vec::new());
    }
    let directory = cases_directory.context(
        "relationship verification failed: manifest declares cases but the cases directory is missing",
    )?;

    let mut found = BTreeMap::new();
    for entry in read_directory(directory, "fixture cases directory")? {
        require_regular_file(&entry, "fixture cassette")?;
        let file_name = entry_name(&entry)?;
        let Some(case_name) = expected.get(&file_name) else {
            bail!("relationship verification failed: undeclared fixture case file {file_name:?}");
        };
        let cassette: HidCassette = read_json(&entry.path(), "HID cassette")?;
        if cassette.name != *case_name {
            bail!(
                "relationship verification failed: cassette file {file_name:?} contains case {:?}",
                cassette.name
            );
        }
        found.insert(file_name, cassette);
    }

    if let Some(missing) = expected.keys().find(|name| !found.contains_key(*name)) {
        bail!("relationship verification failed: missing declared fixture case file {missing:?}");
    }
    Ok(found.into_values().collect())
}

fn case_file_name(case_name: &str) -> Result<String> {
    if matches!(case_name, "." | "..") || case_name.contains('/') || case_name.contains('\\') {
        bail!(
            "relationship verification failed: fixture case name {case_name:?} is not a safe file name"
        );

View on GitHub (pinned to e846e6f4b4)