{"record":{"id":"a7193fb6a18ee684","repo":"influxdata/influxdb","slug":"0-apply","errorCode":null,"errorMessage":"{0}","messagePattern":"\\{0\\}","errorType":"error_code","errorClass":"ApplyError","httpStatus":null,"severity":"critical","filePath":"influxdb3_catalog/src/format/apply.rs","lineNumber":62,"sourceCode":"use crate::format::records::RestoreCatalog;\nuse crate::object_store::versions::v3::ObjectStoreCatalog;\nuse crate::repository::RepositoryError;\n\nuse super::reader::LEGACY_GROUP_INDEX_ENTRY_SIZE;\nuse super::{\n    CatalogFile, Decode, FormatError, Header, REGISTRY, Record, file_flags, record_ids,\n    validate_record_flags,\n};\n\n/// Error returned when applying a catalog record fails.\n///\n/// An `ApplyError` indicates the persisted record is inconsistent with the\n/// current in-memory catalog — typically data corruption or a bug in the\n/// write path. The carried string identifies the record type and the\n/// specific mismatch, intended to give operators actionable context in the\n/// event of catalog corruption.\n#[derive(Debug, Clone, Error)]\n#[error(\"{0}\")]\npub struct ApplyError(pub String);\n\nimpl<I: CatalogId> From<RepositoryError<I>> for ApplyError {\n    fn from(e: RepositoryError<I>) -> Self {\n        Self(e.to_string())\n    }\n}\n\n/// Build a complete catalog file from a pre-encoded payload, header\n/// counts, and flags. Shared by [`serialize_log_file`] and\n/// [`serialize_snapshot_file`], which differ only in the header flags.\nfn make_file_bytes(\n    catalog_uuid: Uuid,\n    sequence_number: u64,\n    payload: Vec<u8>,\n    record_count: u32,\n    group_count: u32,\n    flags: u16,","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_catalog/src/format/apply.rs#L44-L80","documentation":"`ApplyError` is raised when a persisted WAL/log record cannot be applied to the in-memory catalog because the record is inconsistent with current state — indicating data corruption or a bug in the write path. The wrapped string names the record type and the specific mismatch so operators get actionable context. It is produced in `influxdb3_catalog/src/format/apply.rs` when replaying catalog format records.","triggerScenarios":"Opening or replaying the catalog log and encountering a record whose target entity is missing, already exists, or otherwise conflicts with current catalog state (`impl From<RepositoryError<I>> for ApplyError` also converts repository errors).","commonSituations":"Catalog file corruption after a crash or disk failure; manually editing or partially truncating catalog files; restoring an old snapshot over a newer catalog; version mismatch between writer and reader of the catalog format.","solutions":["Restore the catalog from a known-good backup/snapshot","Inspect the catalog files for corruption or manual modification and repair or regenerate them","Check for version mismatch between the catalog writer and the current influxdb3 build and upgrade/downgrade accordingly","If reproducible, capture the record and file a bug — this usually indicates a write-path bug"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match result {\n    Err(ApplyError(msg)) => {\n        log::error!(\"catalog corruption during apply: {msg}\");\n        // halt replay and restore from backup\n    }\n    r => r?,\n}","preventionTips":["Never manually edit catalog files","Take consistent backups/snapshots before upgrades","Keep writer and reader versions of the catalog format aligned","Monitor disks for corruption (fsck, checksums, SMART)"],"tags":["catalog","corruption","replay","persistence"],"backgroundTag":"schema-validation-failed","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}