tursodatabase/turso · error · anyhow::Error

unknown integrity fixture path

Error message

unknown integrity fixture path '{relative_path}'

What it means

`generate_integrity_fixture` dispatches on a known set of relative fixture paths; any unrecognized path hits the catch-all arm and fails with this message. It is an API-contract check: callers must pass one of the exported `INTEGRITY_FIXTURE_*_REL_PATH` constants.

Solutions

  1. Use the exported `INTEGRITY_FIXTURE_*_REL_PATH` constants instead of a literal string.
  2. Check spelling/exact match of the relative path constant.
  3. If adding a new fixture, add a match arm in `generate_integrity_fixture` before calling it.

Example fix

// before
generate_integrity_fixture(&db, "integrity/missing_index.db").await?;
// after
generate_integrity_fixture(&db, INTEGRITY_FIXTURE_MISSING_INDEX_ENTRY_REL_PATH).await?;
Defensive patterns

Strategy: validation

Validate before calling

const VALID_PATHS: &[&str] = &[
    INTEGRITY_FIXTURE_MISSING_INDEX_ENTRY_REL_PATH,
    INTEGRITY_FIXTURE_STRICT_NOT_NULL_VIOLATION_REL_PATH,
    INTEGRITY_FIXTURE_STRICT_REAL_INTEGER_SERIAL_REL_PATH,
];
assert!(VALID_PATHS.contains(&relative_path), "unknown integrity fixture path '{relative_path}'");

Try / catch

match generate_integrity_fixture(&db, rel_path).await {
    Err(e) if e.to_string().contains("unknown integrity fixture path") => {
        eprintln!("bad fixture path {rel_path}; use INTEGRITY_FIXTURE_* constants");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling `generate_integrity_fixture(db_path, relative_path)` with a path string that isn't one of the module's `INTEGRITY_FIXTURE_*_REL_PATH` constants (e.g. a typo'd or hand-written path), from `run_tests` or custom call sites.

Common situations: Hand-typing the fixture path instead of using the exported constant, a renamed/deleted fixture constant after a refactor, or wiring a new integrity fixture before adding its match arm.

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


AI-assisted analysis of tursodatabase/turso@8d4a589f8d (2026-09-20). Data as JSON: /api/errors/07d8adc14b464de0. Report an issue: GitHub.

Appendix: source

Thrown at testing/sqltest/src/generator/mod.rs:1423

        INTEGRITY_FIXTURE_OVERFLOW_LIST_LENGTH_MISMATCH_REL_PATH => {
            generate_overflow_list_length_mismatch_fixture(db_path).await
        }
        INTEGRITY_FIXTURE_GENCOL_NOT_NULL_VIOLATION_REL_PATH => {
            generate_gencol_not_null_violation_fixture(db_path).await
        }
        INTEGRITY_FIXTURE_STRICT_TYPE_VIOLATION_REL_PATH => {
            generate_strict_type_violation_fixture(db_path).await
        }
        INTEGRITY_FIXTURE_STRICT_GENCOL_TYPE_VIOLATION_REL_PATH => {
            generate_strict_gencol_type_violation_fixture(db_path).await
        }
        INTEGRITY_FIXTURE_STRICT_NOT_NULL_VIOLATION_REL_PATH => {
            generate_strict_not_null_violation_fixture(db_path).await
        }
        INTEGRITY_FIXTURE_STRICT_REAL_INTEGER_SERIAL_REL_PATH => {
            generate_strict_real_integer_serial_fixture(db_path).await
        }
        _ => anyhow::bail!("unknown integrity fixture path '{relative_path}'"),
    }
}

/// Backward-compatible helper for older call-sites.
pub async fn generate_integrity_missing_index_entry_fixture(db_path: &Path) -> Result<()> {
    generate_integrity_fixture(db_path, INTEGRITY_FIXTURE_MISSING_INDEX_ENTRY_REL_PATH).await
}

async fn create_tables(conn: &Connection, no_rowid_alias: bool) -> Result<()> {
    let pk_type = if no_rowid_alias {
        "INT PRIMARY KEY"
    } else {
        "INTEGER PRIMARY KEY"
    };

    let users_sql = format!(
        r#"
        CREATE TABLE users (

View on GitHub (pinned to 8d4a589f8d)