quickwit-oss/quickwit · error

source type cannot be changed, current type {}

Error message

source type cannot be changed, current type {}

What it means

SourceConfig::validate_update checks that a source update does not change the source's type. Sources (kafka, kinesis, pulsar, pubsub, file, ingest...) have type-specific params; switching types via update is unsupported — delete and recreate the source instead.

Source

Thrown at quickwit/quickwit-config/src/source_config/mod.rs:290

    fn validate_update(&self, new_source_params: &SourceParams) -> anyhow::Result<()> {
        match (self, new_source_params) {
            (
                SourceParams::File(FileSourceParams::Notifications(current)),
                SourceParams::File(FileSourceParams::Notifications(new)),
            ) => current.validate_update(new),
            (SourceParams::Kafka(current), SourceParams::Kafka(new)) => {
                current.validate_update(new)
            }
            (SourceParams::Kinesis(current), SourceParams::Kinesis(new)) => {
                current.validate_update(new)
            }
            (SourceParams::PubSub(current), SourceParams::PubSub(new)) => {
                current.validate_update(new)
            }
            (SourceParams::Pulsar(current), SourceParams::Pulsar(new)) => {
                current.validate_update(new)
            }
            (current, new) if current.source_type() != new.source_type() => Err(anyhow::anyhow!(
                "source type cannot be changed, current type {}",
                current.source_type(),
            )),
            _ => Err(anyhow::anyhow!(
                "source type {} cannot be updated",
                self.source_type(),
            )),
        }
    }
}

#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Serialize, Deserialize, utoipa::ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum FileSourceMessageType {
    /// See <https://docs.aws.amazon.com/AmazonS3/latest/userguide/notification-content-structure.html>
    S3Notification,
    /// A string with the URI of the file (e.g `s3://bucket/key`)
    RawUri,

View on GitHub (pinned to a39730c5cd)

Solutions

  1. Delete the existing source (`quickwit source delete`) and create a new source with the desired type via `quickwit source create`.
  2. Keep the `source.type` field identical when editing params (e.g. only change kafka topic/broker settings).
  3. Use a different source ID if both source types must coexist on the same index.

Example fix

# before: updating source 'my-source' of type kafka with
type: pulsar
# after: delete then create
quickwit source delete --index my-index --source my-source
quickwit source create --index my-index --source-config new-pulsar-source.yaml
Defensive patterns

Strategy: validation

Validate before calling

async function safeUpdateSource(indexId, sourceId, newCfg) {
  const current = await getSource(indexId, sourceId);
  if (current.source_type !== newCfg.type) {
    throw new Error(`source type cannot change: delete and recreate ${sourceId}`);
  }
  return updateSource(indexId, sourceId, newCfg);
}

Type guard

const typesMatch = (current, next) => current.type === next.type;

Try / catch

try {
  await updateSource(indexId, sourceId, cfg);
} catch (e) {
  if (String(e).includes('source type cannot be changed')) {
    await deleteSource(indexId, sourceId);
    await createSource(indexId, sourceId, cfg);
  } else throw e;
}

Prevention

When it happens

Trigger: Calling the source update API/CLI (e.g. `quickwit source update` or PUT /indexes/{index}/sources/{source}) with a new source config whose `source_type()` differs from the existing source's type, e.g. updating a kafka source with a pulsar config.

Common situations: Reusing a source config YAML template for a different source technology while keeping the same source ID; swapping a deprecated source type for a new one in place; automation that overwrites source definitions wholesale.

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


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