{"record":{"id":"243a43747827f9cb","repo":"risingwavelabs/risingwave","slug":"field-field-is-not-allowed-to-be-altered-on-th-243a43","errorCode":null,"errorMessage":"Field '{field}' is not allowed to be altered on the fly for connector: {connector_name}","messagePattern":"Field '(.+?)' is not allowed to be altered on the fly for connector: (.+?)","errorType":"validation","errorClass":"ConnectorError","httpStatus":null,"severity":"error","filePath":"src/connector/src/with_options_test.rs","lineNumber":807,"sourceCode":"/// Returns Ok(()) if all fields are allowed, otherwise returns a `ConnectorError`.\npub fn check_source_allow_alter_on_fly_fields(\n    connector_name: &str,\n    fields: &[String],\n) -> crate::error::ConnectorResult<()> {{\n    // Convert connector name to the type name key\n    let Some(type_name) = source_properties::source_name_to_prop_type_name(connector_name) else {{\n        return Err(ConnectorError::from(anyhow::anyhow!(\n            \"Unknown source connector: {{connector_name}}\"\n        )));\n    }};\n    let Some(allowed_fields) = SOURCE_ALLOW_ALTER_ON_FLY_FIELDS.get(type_name) else {{\n    return Err(ConnectorError::from(anyhow::anyhow!(\n        \"No allow_alter_on_fly fields registered for connector: {{connector_name}}\"\n    )));\n    }};\n    for field in fields {{\n        if !allowed_fields.contains(field) {{\n            return Err(ConnectorError::from(anyhow::anyhow!(\n                \"Field '{{field}}' is not allowed to be altered on the fly for connector: {{connector_name}}\"\n            )));\n        }}\n    }}\n    Ok(())\n}}\n\npub fn check_connection_allow_alter_on_fly_fields(\n    connection_name: &str,\n    fields: &[String],\n) -> crate::error::ConnectorResult<()> {{\n    use crate::source::connection_name_to_prop_type_name;\n\n    // Convert connection name to the type name key\n    let Some(type_name) = connection_name_to_prop_type_name(connection_name) else {{\n        return Err(ConnectorError::from(anyhow::anyhow!(\n            \"Unknown connection: {{connection_name}}\"\n        )));","sourceCodeStart":789,"sourceCodeEnd":825,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/with_options_test.rs#L789-L825","documentation":"Error emitted by generated validation code for `ALTER SOURCE ... ALTER on the fly`: the named field is not present in SOURCE_ALLOW_ALTER_ON_FLY_FIELDS for that connector, so altering it without a restart is rejected. This is a generic whitelist guard produced by the code generator; the input at fault is the field name passed to check_source_allow_alter_on_fly_fields.","triggerScenarios":"Calling check_source_allow_alter_on_fly_fields (e.g. during ALTER SOURCE / schema-change validation) with a field name that is not in SOURCE_ALLOW_ALTER_ON_FLY_FIELDS for that connector.","commonSituations":"Attempting to alter a non-mutable column (e.g. Kafka message key or header field) on the fly; typo in the field name; trying an alteration pattern the connector's schema evolution does not support.","solutions":["Check the connector's registered allow_alter_on_fly fields and only alter supported fields.","Fix field-name casing/typos to match the schema exactly.","Plan the change as a full rebuild/refresh of the source instead of an on-the-fly alteration.","If the field should be alterable, add it to the connector's allow list and regenerate."],"exampleFix":"// before\ncheck_source_allow_alter_on_fly_fields(\"kafka\", &[\"message.key\".into()])?;\n// after\ncheck_source_allow_alter_on_fly_fields(\"kafka\", &[\"upsert_avro_primary_key\".into()])?;","handlingStrategy":"validation","validationCode":"fn can_alter(connector: &str, field: &str) -> bool {\n    source_properties::source_name_to_prop_type_name(connector)\n        .and_then(|t| SOURCE_ALLOW_ALTER_ON_FLY_FIELDS.get(t))\n        .map(|f| f.iter().any(|x| x == field))\n        .unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"match check_source_allow_alter_on_fly_fields(connector, &fields) {\n    Err(e) => return Err(sql_error::unsupported(&format!(\"alter rejected: {e}\"))),\n    Ok(()) => proceed_with_alter(),\n}","preventionTips":["List the connector's alterable fields (information schema) before issuing ALTER","Match field names exactly, including case","Fall back to a full source rebuild for unsupported alterations"],"tags":["connector","schema-change","field-validation"],"backgroundTag":"unsupported-operation","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}