quickwit-oss/quickwit · error · IndexServiceError

`source_id` in config file does not match source_id from que

Error message

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

What it means

On the update-source REST endpoint, when the source does not exist and create=true, the endpoint loads the source config from the request body and verifies its source_id matches the source_id in the URL path. A mismatch aborts with this error to prevent creating a source under a different identity than requested.

Source

Thrown at quickwit/quickwit-serve/src/index_api/source_resource.rs:171

    config_format: ConfigFormat,
    query_params: UpdateQueryParams,
    source_config_bytes: Bytes,
    mut index_service: IndexService,
) -> Result<SourceConfig, IndexServiceError> {
    let index_metadata_request = IndexMetadataRequest::for_index_id(index_id.to_string());
    let mut current_index_metadata = index_service
        .metastore()
        .index_metadata(index_metadata_request)
        .await?
        .deserialize_index_metadata()?;
    let current_source_config = match current_index_metadata.sources.remove(&source_id) {
        Some(source_config) => source_config,
        None if query_params.create => {
            let source_config: SourceConfig =
                load_source_config_from_user_config(config_format, &source_config_bytes)
                    .map_err(IndexServiceError::InvalidConfig)?;
            if source_config.source_id != source_id {
                return Err(IndexServiceError::InvalidConfig(anyhow::anyhow!(
                    "`source_id` in config file does not match source_id from query path"
                )));
            }
            check_source_type(&source_config.source_params)?;
            info!(index_id = %index_id, source_id = %source_config.source_id, "create-source-on-update");
            // TODO handle already exists?
            return index_service
                .add_source(current_index_metadata.index_uid, source_config)
                .await;
        }
        None => {
            return Err(MetastoreError::NotFound(EntityKind::Source {
                index_id: index_id.to_string(),
                source_id,
            })
            .into());
        }
    };

View on GitHub (pinned to a39730c5cd)

Solutions

  1. Make source_id in the config file match the source_id in the request path.
  2. Or issue the request against the path matching the config's source_id.
  3. Template both the URL and config source_id from one variable in automation.

Example fix

// before: PUT /indexes/my-index/sources/my-source with
version: 0.8
source_id: old-source
// after
version: 0.8
source_id: my-source
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

match client.update_source(index_id, source_id, config_bytes).await {
    Err(e) if e.to_string().contains("does not match source_id from query path") => {
        Err(anyhow!("align config source_id with path `{source_id}`"))
    }
    r => r,
}

Prevention

When it happens

Trigger: PUT /indexes/{index_id}/sources/{source_id}?create=true with a source config body whose source_id differs from the {source_id} path parameter.

Common situations: Reusing a shared source config file across multiple sources; renaming a source in the path but not in the config; templating scripts where only one of the two identifiers was updated.

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/4ebd3b2fe03a7e31. Report an issue: GitHub.