{"record":{"id":"b2608caade18771b","repo":"risingwavelabs/risingwave","slug":"feature-source-is-not-enabled-at-compile-time","errorCode":null,"errorMessage":"Feature `source-{}` is not enabled at compile time. Please enable it in `Cargo.toml` and rebuild.","messagePattern":"Feature `source-(.+?)` is not enabled at compile time\\. Please enable it in `Cargo\\.toml` and rebuild\\.","errorType":"error_code","errorClass":"ConnectorError","httpStatus":null,"severity":"error","filePath":"src/connector/src/source/utils.rs","lineNumber":50,"sourceCode":"        #[cfg(not(feature = \"source-\" $source_name))]\n        pub mod $mod_name {\n            use std::collections::HashMap;\n\n            use anyhow::anyhow;\n            use async_trait::async_trait;\n            use risingwave_common::types::JsonbVal;\n            use serde::{Deserialize, Serialize};\n\n            use crate::error::{ConnectorError, ConnectorResult};\n            use crate::parser::ParserConfig;\n            use crate::source::{\n                BoxSourceChunkStream, Column, SourceContextRef, SourceEnumeratorContextRef,\n                SourceProperties, SplitEnumerator, SplitId, SplitMetaData, SplitReader, UnknownFields,\n            };\n            pub const [<$source_name:upper _CONNECTOR>]: &'static str = $source_name;\n\n            fn err_feature_not_enabled() -> ConnectorError {\n                ConnectorError::from(anyhow!(\n                    \"Feature `source-{}` is not enabled at compile time. \\\n                    Please enable it in `Cargo.toml` and rebuild.\",\n                    $source_name\n                ))\n            }\n\n            #[doc = \"A dummy source properties that always returns an error, as the feature `source-\" $source_name \"` is currently not enabled.\"]\n            #[derive(Clone, Debug, Deserialize, with_options::WithOptions)]\n            pub struct [<$struct_prefix:camel Properties>] {\n                #[serde(flatten)]\n                pub unknown_fields: HashMap<String, String>,\n            }\n\n            impl crate::enforce_secret::EnforceSecret for [<$struct_prefix:camel Properties>] {\n                const ENFORCE_SECRET_PROPERTIES: phf::Set<&'static str> = phf::phf_set! {};\n            }\n\n            impl UnknownFields for [<$struct_prefix:camel Properties>] {","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/source/utils.rs#L32-L68","documentation":"Each RisingWave connector is gated behind a cargo feature named `source-<connector>`. The macro-generated stub generates functions that, when the feature is off, immediately return this error instead of linking real implementations, so callers discover at runtime that the connector was not compiled in.","triggerScenarios":"Using a connector (e.g. `nats`, `google_pubsub`) whose `source-<name>` feature is not enabled in the Cargo.toml of the built binary; every generated accessor for that source returns err_feature_not_enabled().","commonSituations":"Running a slim/all-in-one binary built with a reduced feature set, deploying a custom build missing the feature, or a distro package that disabled optional connectors.","solutions":["Enable the feature in Cargo.toml, e.g. risingwave_connector = { features = [\"source-nats\"] }, and rebuild","Use an official binary/profile that includes the required connector feature","Verify with `cargo tree -e features` or build logs that the feature is actually active in the deployed build"],"exampleFix":"// before (Cargo.toml)\nrisingwave_connector = { path = \"../connector\" }\n// after\nrisingwave_connector = { path = \"../connector\", features = [\"source-nats\"] }","handlingStrategy":"try-catch","validationCode":"// at build/deploy time, assert the connector feature is present\ncargo tree -e features | grep 'source-nats' || echo 'feature missing: source-nats'","typeGuard":null,"tryCatchPattern":"match connector_factory(config) { Err(e) if String(e).contains(\"is not enabled at compile time\") => { enable_feature_and_rebuild_or_use_alternate_connector(); } , r => r }","preventionTips":["Enable every connector feature you deploy with in Cargo.toml","Compare deployed binary features with the connectors used in SQL definitions","Add a smoke test that constructs each required connector at startup"],"tags":["compile-time","feature-flags","cargo"],"backgroundTag":"feature-not-enabled","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}