quickwit-oss/quickwit · error · IndexServiceError

`index_id` in config file does not match index_id from query

Error message

`index_id` in config file does not match index_id from query path

What it means

On the update-index REST endpoint, if the request includes an index config file whose index_id differs from the index_id given in the URL path, the endpoint refuses to proceed. It prevents silently creating or updating an index under a different identity than specified in the path.

Source

Thrown at quickwit/quickwit-serve/src/index_api/index_resource.rs:363

    node_config: Arc<NodeConfig>,
) -> Result<IndexMetadata, IndexServiceError> {
    info!(index_id = %target_index_id, "update-index");

    let metastore = index_service.metastore();
    let index_metadata_request = IndexMetadataRequest::for_index_id(target_index_id.to_string());
    let current_index_metadata_res = metastore.index_metadata(index_metadata_request).await;

    let current_index_metadata_ser = match current_index_metadata_res {
        Ok(index_metadata) => index_metadata,
        Err(MetastoreError::NotFound(_)) if query_params.create => {
            let index_config = quickwit_config::load_index_config_from_user_config(
                config_format,
                &index_config_bytes,
                &node_config.default_index_root_uri,
            )
            .map_err(IndexServiceError::InvalidConfig)?;
            if index_config.index_id != target_index_id {
                return Err(IndexServiceError::InvalidConfig(anyhow::anyhow!(
                    "`index_id` in config file does not match index_id from query path"
                )));
            }
            info!(index_id = %index_config.index_id, "create-index-on-update");
            match index_service.create_index(index_config, false).await {
                Err(IndexServiceError::Metastore(MetastoreError::AlreadyExists(_))) => {
                    // If the index was created just after we tried to update it, try to update as
                    // if nothing happened. But if it gets deleted again before we update it, just
                    // error out
                    let index_metadata_request =
                        IndexMetadataRequest::for_index_id(target_index_id.to_string());
                    metastore.index_metadata(index_metadata_request).await?
                }
                other => return other,
            }
        }
        Err(e) => return Err(e.into()),
    };

View on GitHub (pinned to a39730c5cd)

Solutions

  1. Make the index_id in the config file match the index_id in the request path.
  2. Or omit/adjust the path index_id so it corresponds to the config's index_id.
  3. In automation, template the config file's index_id from the same variable used to build the URL.

Example fix

// before: PUT /indexes/my-index with config containing
version: 0.8
index_id: old-index
// after
version: 0.8
index_id: my-index
Defensive patterns

Strategy: validation

Validate before calling

fn assert_index_id_match(path_index_id: &str, config: &serde_yaml::Value) -> Result<(), String> {
    let cfg_id = config["index_id"].as_str().ok_or("missing index_id in config")?;
    if cfg_id != path_index_id { Err(format!("config index_id `{cfg_id}` != path `{path_index_id}`")) } else { Ok(()) }
}

Try / catch

match client.update_index(index_id, config_bytes).await {
    Err(e) if e.to_string().contains("does not match index_id from query path") => {
        Err(anyhow!("fix index_id in config to match path `{index_id}`"))
    }
    r => r,
}

Prevention

When it happens

Trigger: PUT /indexes/{index_id} (update_index) with a config body whose index_id does not equal the {index_id} path parameter and where the index does not yet exist (create-on-update path).

Common situations: Reusing one YAML config file against multiple index endpoints; renamed index in config but not in the URL (or vice versa); templated automation scripts passing a generic config.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of quickwit-oss/quickwit@a39730c5cd (2026-09-08). Data as JSON: /api/errors/1b3d76bc65f3b5a8. Report an issue: GitHub.