influxdata/influxdb · error · PathError

Invalid table ID

Error message

Invalid table ID: {0}

What it means

PathError::InvalidTableId occurs when the table identifier component of a storage path fails validation — the component is not a well-formed table ID. Like InvalidDbId it includes the offending value and prevents malformed keys from being treated as table paths.

Solutions

  1. Inspect the invalid table segment from the error and fix or delete the offending object
  2. Avoid manual edits to object-store keys; recreate tables through the API
  3. Confirm both producer and consumer code use the same table-ID format (numeric vs name)
  4. Restore affected prefixes from a known-good backup if the store was corrupted

Example fix

// before
// key: databases/12/tables/cpu/1.parquet (name 'cpu' where id expected)
// after
// key: databases/12/tables/42/1.parquet (valid table id)
Defensive patterns

Strategy: validation

Validate before calling

fn valid_table_id(seg: &str) -> bool {
    seg.parse::<u64>().map(|id| id > 0).unwrap_or(false)
}

Type guard

fn is_valid_table_segment(s: &str) -> bool {
    s.parse::<u64>().is_ok()
}

Try / catch

match parse_table_path(key) {
    Err(PathError::InvalidTableId(bad)) => {
        log::warn!("invalid table id {:?} in {} — quarantining", bad, key);
        quarantine(key);
        continue;
    }
    Ok(p) => handle(p),
}

Prevention

When it happens

Trigger: Parsing object-store keys where the table segment is empty, non-numeric, or otherwise fails the table-ID validator, typically during listing/recovery scans of table data files.

Common situations: Manual object-store manipulation (renamed or copied directories); files from incompatible versions; corruption or truncation of keys during failed uploads/restores.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/15961ca1add0474e. Report an issue: GitHub.

Appendix: source

Thrown at influxdb3_write/src/paths.rs:21

use influxdb3_id::{DbId, TableId, TableIndexId};
use influxdb3_wal::{SnapshotSequenceNumber, WalFileSequenceNumber};
use object_store::path::Path as ObjPath;
use regex::Regex;
use std::ops::Deref;
use std::str::FromStr;
use std::sync::{Arc, LazyLock};
use thiserror::Error;

/// Errors that can occur when parsing paths
#[derive(Debug, Error)]
pub enum PathError {
    #[error("Invalid path format: expected {expected}, got: {actual}")]
    InvalidFormat { expected: String, actual: String },

    #[error("Invalid database ID: {0}")]
    InvalidDbId(String),

    #[error("Invalid table ID: {0}")]
    InvalidTableId(String),

    #[error("Invalid sequence number in {context}: {filename}")]
    InvalidSequenceNumber { context: String, filename: String },
}

/// File extension for parquet files
pub const PARQUET_FILE_EXTENSION: &str = "parquet";

/// File extension for snapshot info files
pub const SNAPSHOT_INFO_FILE_EXTENSION: &str = "info.json";

/// File extension for checkpoint files
pub const CHECKPOINT_FILE_EXTENSION: &str = "checkpoint.json";

fn object_store_file_stem(n: u64) -> u64 {
    u64::MAX - n
}

View on GitHub (pinned to 06200ef96b)