{"record":{"id":"a472da86e4432276","repo":"risingwavelabs/risingwave","slug":"field-field-is-not-allowed-to-be-altered-on-th-a472da","errorCode":null,"errorMessage":"Field '{field}' is not allowed to be altered on the fly for connection: {connection_name}","messagePattern":"Field '(.+?)' is not allowed to be altered on the fly for connection: (.+?)","errorType":"validation","errorClass":"ConnectorError","httpStatus":null,"severity":"error","filePath":"src/connector/src/with_options_test.rs","lineNumber":834,"sourceCode":"    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        )));\n    }};\n    let Some(allowed_fields) = CONNECTION_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 connection: {{connection_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 connection: {{connection_name}}\"\n            )));\n        }}\n    }}\n    Ok(())\n}}\n\n/// Checks if all given fields are allowed to be altered on the fly for the specified sink connector.\n/// Returns Ok(()) if all fields are allowed, otherwise returns a `ConnectorError`.\npub fn check_sink_allow_alter_on_fly_fields(\n    sink_name: &str,\n    fields: &[String],\n) -> crate::error::ConnectorResult<()> {{\n    // TODO(#24846): JDBC sink currently uses `()` as sink config type in `for_all_sinks!`,\n    // so it cannot have an isolated key in `SINK_ALLOW_ALTER_ON_FLY_FIELDS`.\n    // Reuse the JDBC entry in `CONNECTION_ALLOW_ALTER_ON_FLY_FIELDS` for now.\n    // TODO(#24846): remove this special case after JDBC sink has a dedicated config type\n    // and allow-alter fields are generated directly into `SINK_ALLOW_ALTER_ON_FLY_FIELDS`.","sourceCodeStart":816,"sourceCodeEnd":852,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/with_options_test.rs#L816-L852","documentation":"Generated-code guard for `ALTER CONNECTION`: the requested field is not in the CONNECTION_ALLOW_ALTER_ON_FLY_FIELDS whitelist for that connection type, so altering it on the fly fails. Generic whitelist check; the offending input is the field name not registered for the connection.","triggerScenarios":"Validating an ALTER on a connection field (e.g. a private-link field) that is not in CONNECTION_ALLOW_ALTER_ON_FLY_FIELDS for that connection type.","commonSituations":"Trying to mutate immutable connection fields (endpoint, port, credentials) without recreating the connection; field-name typo; attempting unsupported live schema change.","solutions":["Alter only fields listed in the connection's allow_alter_on_fly registry.","Drop and recreate the connection with the new field value if it is immutable.","Correct field name spelling/case.","Add the field to the allow list and regenerate if it should be mutable."],"exampleFix":"// before\ncheck_connection_allow_alter_on_fly_fields(\"privatelink\", &[\"endpoint\".into()])?;\n// after\nDROP CONNECTION privatelink;\nCREATE CONNECTION privatelink WITH (... new endpoint ...);","handlingStrategy":"validation","validationCode":"fn can_alter_connection(name: &str, field: &str) -> bool {\n    connection_name_to_prop_type_name(name)\n        .and_then(|t| CONNECTION_ALLOW_ALTER_ON_FLY_FIELDS.get(t))\n        .map(|f| f.contains(&field.to_string()))\n        .unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"match check_connection_allow_alter_on_fly_fields(name, &fields) {\n    Err(e) => suggest_recreate_connection(&e),\n    Ok(()) => proceed(),\n}","preventionTips":["Treat connection credentials/endpoints as immutable; recreate connections to change them","Verify field names against the connection's registered schema"],"tags":["connection","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"}