quickwit-oss/quickwit · error

{label} ID `{value}` is invalid: identifiers must match the

Error message

{label} ID `{value}` is invalid: identifiers must match the following regular expression: `^[a-zA-Z][a-zA-Z0-9-_\.]{{2,254}}$`

What it means

`validate_identifier` enforces Quickwit naming conventions for IDs (index, source, template, etc.). The value must match `^[a-zA-Z][a-zA-Z0-9-_\.]{2,254}$`: start with a letter, then 2-254 characters of letters, digits, `-`, `_`, or `.`. Any ID violating this regex is rejected with a message containing the label and offending value.

Source

Thrown at quickwit/quickwit-config/src/lib.rs:147

    SourceInputFormat,
    SourceParams,
    StableLogMergePolicyConfig,
    TransformConfig,
    VecSourceParams,
    VersionedIndexConfig,
    VersionedIndexTemplate,
    VersionedSourceConfig,
    VoidSourceParams,
)))]
/// Schema used for the OpenAPI generation which are apart of this crate.
pub struct ConfigApiSchemas;

/// Checks whether an identifier conforms to Quickwit naming conventions.
pub fn validate_identifier(label: &str, value: &str) -> anyhow::Result<()> {
    static IDENTIFIER_REGEX: LazyLock<Regex> = LazyLock::new(|| {
        Regex::new(r"^[a-zA-Z][a-zA-Z0-9-_\.]{2,254}$").expect("regular expression should compile")
    });
    ensure!(
        IDENTIFIER_REGEX.is_match(value),
        "{label} ID `{value}` is invalid: identifiers must match the following regular \
         expression: `^[a-zA-Z][a-zA-Z0-9-_\\.]{{2,254}}$`"
    );
    Ok(())
}

/// Checks whether an index ID pattern conforms to Quickwit conventions.
/// Index ID patterns accept the same characters as identifiers AND accept `*`
/// chars to allow for glob-like patterns.
pub fn validate_index_id_pattern(pattern: &str, allow_negative: bool) -> anyhow::Result<()> {
    static IDENTIFIER_REGEX_WITH_GLOB_PATTERN: LazyLock<Regex> = LazyLock::new(|| {
        Regex::new(r"^[a-zA-Z\*][a-zA-Z0-9-_\.\*]{0,254}$")
            .expect("regular expression should compile")
    });
    static IDENTIFIER_REGEX_WITH_GLOB_PATTERN_NEGATIVE: LazyLock<Regex> = LazyLock::new(|| {
        Regex::new(r"^-?[a-zA-Z\*][a-zA-Z0-9-_\.\*]{0,254}$")
            .expect("regular expression should compile")

View on GitHub (pinned to a39730c5cd)

Solutions

  1. Rename the entity so the ID starts with a letter and uses only `[a-zA-Z0-9-_\.]` with length 3-255
  2. Strip whitespace/newlines from CLI or API-supplied IDs before calling the API
  3. Prefix generated IDs (e.g. UUIDs) with a letter, such as `idx-<uuid>`

Example fix

// before
let index_id = "2024_logs";
// after
let index_id = "idx-2024-logs";
Defensive patterns

Strategy: validation

Validate before calling

fn is_valid_quickwit_id(value: &str) -> bool {
    let bytes = value.as_bytes();
    if bytes.len() < 3 || bytes.len() > 255 { return false; }
    if !bytes[0].is_ascii_alphabetic() { return false; }
    bytes.iter().all(|&b| b.is_ascii_alphanumeric() || b == b'-' || b == b'_' || b == b'.')
}

Type guard

function isValidQuickwitId(value) {
  return /^[a-zA-Z][a-zA-Z0-9-_.]{2,254}$/.test(value);
}

Try / catch

match quickwit_config::validate_identifier("index", &index_id) {
    Err(e) => {
        eprintln!("{e}: choose an ID starting with a letter, 3-255 chars of [a-zA-Z0-9-_.]");
        return Err(e);
    }
    Ok(()) => {}
}

Prevention

When it happens

Trigger: Creating/updating an index, source, or template whose ID starts with a digit or symbol, contains spaces/slashes/uppercase-hostile characters beyond the allowed set, or is shorter than 3 characters or longer than 255.

Common situations: Using a UUID or timestamp as the index id (starts with a digit); deriving an id from a filename with invalid characters; a trailing newline or whitespace sneaking into a CLI-provided source id (`add_source`, `delete_source_cli`).

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 quickwit-oss/quickwit@a39730c5cd (2026-09-08). Data as JSON: /api/errors/11c927b988f13d8a. Report an issue: GitHub.