{"record":{"id":"be9c7ac2b38161fb","repo":"influxdata/influxdb","slug":"invalid-path-format-expected-expected-got-actual","errorCode":null,"errorMessage":"Invalid path format: expected {expected}, got: {actual}","messagePattern":"Invalid path format: expected (.+?), got: (.+?)","errorType":"exception","errorClass":"PathError","httpStatus":null,"severity":"error","filePath":"influxdb3_write/src/paths.rs","lineNumber":15,"sourceCode":"use crate::YearMonth;\nuse chrono::prelude::*;\nuse influxdb3_id::{DbId, TableId, TableIndexId};\nuse influxdb3_wal::{SnapshotSequenceNumber, WalFileSequenceNumber};\nuse object_store::path::Path as ObjPath;\nuse regex::Regex;\nuse std::ops::Deref;\nuse std::str::FromStr;\nuse std::sync::{Arc, LazyLock};\nuse thiserror::Error;\n\n/// Errors that can occur when parsing paths\n#[derive(Debug, Error)]\npub enum PathError {\n    #[error(\"Invalid path format: expected {expected}, got: {actual}\")]\n    InvalidFormat { expected: String, actual: String },\n\n    #[error(\"Invalid database ID: {0}\")]\n    InvalidDbId(String),\n\n    #[error(\"Invalid table ID: {0}\")]\n    InvalidTableId(String),\n\n    #[error(\"Invalid sequence number in {context}: {filename}\")]\n    InvalidSequenceNumber { context: String, filename: String },\n}\n\n/// File extension for parquet files\npub const PARQUET_FILE_EXTENSION: &str = \"parquet\";\n\n/// File extension for snapshot info files\npub const SNAPSHOT_INFO_FILE_EXTENSION: &str = \"info.json\";\n","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_write/src/paths.rs#L1-L33","documentation":"PathError::InvalidFormat is produced by the paths module when a storage path string does not match the expected structural pattern (expected vs actual are embedded in the message). The paths module parses object-store keys for databases, tables, and files, and this error signals the shape itself was wrong before any component could be interpreted.","triggerScenarios":"Parsing object-store keys (e.g. listing files and parsing each into a typed path struct) where a key has the wrong number of segments, wrong prefix, or wrong layout for the expected path type.","commonSituations":"Legacy or manually created files in the object store bucket; objects placed by a different InfluxDB version with changed path layouts; stray objects uploaded by tooling polluting the namespace.","solutions":["Compare the `expected` and `actual` values in the message to see which layout was assumed","Remove or move foreign/legacy objects out of the paths being scanned","Ensure the writer and reader use compatible influxdb3 versions so path layouts match","Add explicit filtering of object keys before parsing so only matching prefixes are parsed"],"exampleFix":"// before\nfor obj in list { let p = DbPath::parse(obj.location)?; } // fails on foreign keys\n// after\nfor obj in list.filter(|o| o.location.prefix_starts_with(&Path::from(\"db\"))) {\n    let p = DbPath::parse(obj.location)?;\n}","handlingStrategy":"try-catch","validationCode":"fn matches_prefix(key: &str, prefix: &str, segments: usize) -> bool {\n    key.starts_with(prefix) && key.split('/').count() == segments\n}","typeGuard":"fn is_parsable_db_path(key: &object_store::path::Path) -> bool {\n    key.parts().count() == EXPECTED_SEGMENTS && key.to_string().starts_with(\"databases/\")\n}","tryCatchPattern":"match DbPath::parse(key) {\n    Err(PathError::InvalidFormat { expected, actual }) => {\n        log::warn!(\"skipping non-conforming object {} (expected {}, got {})\", key, expected, actual);\n        continue; // or quarantine the object\n    }\n    r => r?,\n}","preventionTips":["Filter object keys by prefix and shape before parsing each into a typed path","Never hand-place files into the influxdb object-store namespace","Keep reader and writer on compatible influxdb3 versions","Log-and-skip unexpected keys during scans instead of failing the whole listing"],"tags":["rust","path","parsing"],"backgroundTag":"invalid-argument-format","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"}