{"record":{"id":"173be7ec3229ad41","repo":"quickwit-oss/quickwit","slug":"existing-source-id-does-not-match-updated-so","errorCode":null,"errorMessage":"existing `source_id` {} does not match updated `source_id` {}","messagePattern":"existing `source_id` (.+?) does not match updated `source_id` (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-config/src/source_config/serialize.rs","lineNumber":77,"sourceCode":"    source_config_for_serialization.validate_and_build()\n}\n\n/// Parses and validates a [`SourceConfig`] update.\n///\n/// Ensures that the new configuration is valid in itself and compared to the\n/// current source config. If the new configuration omits some fields, the\n/// default values will be used, not those of the current source config.\npub fn load_source_config_update(\n    config_format: ConfigFormat,\n    config_content: &[u8],\n    current_source_config: &SourceConfig,\n) -> anyhow::Result<SourceConfig> {\n    let versioned_source_config: VersionedSourceConfig = config_format.parse(config_content)?;\n    let source_config_for_serialization: SourceConfigForSerialization =\n        versioned_source_config.into();\n    let new_source_config = source_config_for_serialization.validate_and_build()?;\n\n    ensure!(\n        current_source_config.source_id == new_source_config.source_id,\n        \"existing `source_id` {} does not match updated `source_id` {}\",\n        current_source_config.source_id,\n        new_source_config.source_id\n    );\n\n    current_source_config\n        .source_params\n        .validate_update(&new_source_config.source_params)?;\n\n    Ok(new_source_config)\n}\n\nimpl SourceConfigForSerialization {\n    /// Checks the validity of the `SourceConfig` as a \"deserializable source\".\n    ///\n    /// Two remarks:\n    /// - This does not check connectivity, it just validate configuration, without performing any","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-config/src/source_config/serialize.rs#L59-L95","documentation":"When updating an existing source, the `source_id` embedded in the submitted config must match the `source_id` of the source being replaced. `load_source_config_update` compares the two and fails if they differ, since the update path cannot rename sources — the id identifies the metastore record being overwritten.","triggerScenarios":"Calling `update_source` (or `load_source_config_update` directly, e.g. in tests) with a config file whose `source_id`/`versioned` id differs from `current_source_config.source_id`.","commonSituations":"Editing a source config file and renaming the `source_id` (or the file's id field / CLI `--source-id`) while updating; applying a source config template that carries a different id than the deployed source.","solutions":["Edit the submitted config so its `source_id` equals the existing source's id, then retry the update.","Invoke the update with the correct existing source identifier (e.g. `quickwit source update --source-id <existing>`).","To genuinely rename a source, delete the old source and create a new one with the new id."],"exampleFix":"// before (source.json used for update)\n{\"source_id\": \"kafka-new\", \"source_type\": \"kafka\", ...}  // stored id: kafka-src\n\n// after (source.json)\n{\"source_id\": \"kafka-src\", \"source_type\": \"kafka\", ...}","handlingStrategy":"validation","validationCode":"let current = client.get_source(index_id, source_id).await?;\nlet submitted: SourceConfig = parse_source_config(file_content)?;\nassert_eq!(submitted.source_id, current.source_id,\n    \"update must target the existing source_id {}\", current.source_id);","typeGuard":null,"tryCatchPattern":"match client.update_source(index_id, source_id, new_config).await {\n    Err(e) if e.to_string().contains(\"does not match updated `source_id`\") =>\n        bail!(\"source_id in the config file must equal the source being updated\"),\n    other => other?,\n}","preventionTips":["Generate update payloads from the fetched current source so source_id stays in sync.","Never hand-edit source_id when changing other fields of a source config.","For renames, script delete+create rather than update."],"tags":["source","validation","identifier","update"],"backgroundTag":"invalid-identifier","analyzedSha":"a39730c5cdcd1a4fe798403737ae293999ea21f8","analyzedAt":"2026-09-08T13:19:37.784Z","contentChangedAt":"2026-09-08T13:19:37.784Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}