{"record":{"id":"7f8124a92e585507","repo":"transact-rs/sqlx","slug":"one-of-the-runtime-features-of-sqlx-must-be-enab","errorCode":null,"errorMessage":"one of the `runtime` features of SQLx must be enabled","messagePattern":"one of the `runtime` features of SQLx must be enabled","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"sqlx-core/src/rt/mod.rs","lineNumber":169,"sourceCode":"        } else if #[cfg(feature = \"_rt-tokio\")] {\n            tokio::runtime::Builder::new_current_thread()\n                .enable_all()\n                .build()\n                .expect(\"failed to start Tokio runtime\")\n                .block_on(f)\n        } else {\n            missing_rt(f)\n        }\n    }\n}\n\n#[track_caller]\npub const fn missing_rt<T>(_unused: T) -> ! {\n    if cfg!(feature = \"_rt-tokio\") {\n        panic!(\"this functionality requires a Tokio context\")\n    }\n\n    panic!(\"one of the `runtime` features of SQLx must be enabled\")\n}\n\nimpl<T: Send + 'static> Future for JoinHandle<T> {\n    type Output = T;\n\n    #[track_caller]\n    fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {\n        match &mut *self {\n            #[cfg(feature = \"_rt-async-std\")]\n            Self::AsyncStd(handle) => Pin::new(handle).poll(cx),\n\n            #[cfg(feature = \"_rt-async-task\")]\n            Self::AsyncTask(task) => Pin::new(task)\n                .as_pin_mut()\n                .expect(\"BUG: task taken\")\n                .poll(cx),\n\n            #[cfg(feature = \"_rt-tokio\")]","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/transact-rs/sqlx/blob/03af8bcc5711a1935580a54bea249c219a0c217d/sqlx-core/src/rt/mod.rs#L151-L187","documentation":"The second branch of missing_rt() in sqlx-core/src/rt/mod.rs: panics when NO sqlx `runtime` feature is enabled at compile time (`cfg!(feature = \"_rt-tokio\")` is false). sqlx's runtime-independent API needs at least one `runtime-*` feature to select the async executor implementation; without it, any API that touches the runtime abstraction cannot work.","triggerScenarios":"Using sqlx with Cargo.toml features that omit any `runtime-*` feature, e.g. `features = [\"postgres\"]` only, or `default-features = true` lost via a dependency that re-specifies sqlx without runtime features. Any pool/connect/query call then panics at first use.","commonSituations":"Feature unification surprises: a workspace member enables sqlx with `default-features = false` and no runtime feature; copying a minimal Cargo.toml snippet; upgrading to sqlx 0.7+ where `runtime-async-std` etc. were removed/renamed.","solutions":["Add a runtime feature: `sqlx = { features = [\"runtime-tokio\", \"postgres\"] }` (or `-rustls`/`-native-tls` variants).","Search the workspace for `default-features = false` on the sqlx dependency and ensure at least one member enables a runtime feature.","Run `cargo tree -i sqlx` and `cargo tree -e features` to confirm which feature set is actually compiled in."],"exampleFix":"// before (Cargo.toml)\nsqlx = { version = \"0.8\", features = [\"postgres\"], default-features = false }\n\n// after\nsqlx = { version = \"0.8\", features = [\"runtime-tokio\", \"postgres\"], default-features = false }","handlingStrategy":"validation","validationCode":"// Cargo.toml — fail compilation if no runtime feature:\n[features]\ndefault = [\"runtime-tokio\"]\n\n// or in code:\n#[cfg(not(any(feature = \"runtime-tokio\")))]\ncompile_error!(\"sqlx requires a runtime-* feature\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never specify sqlx with default-features = false without adding a runtime feature","Pin the sqlx feature set in a single workspace-level dependency","Verify features with `cargo tree -e features -i sqlx` in CI"],"tags":["configuration","feature-flags","async","sqlx"],"backgroundTag":"missing-runtime-feature","analyzedSha":"03af8bcc5711a1935580a54bea249c219a0c217d","analyzedAt":"2026-09-03T15:01:28.752Z","contentChangedAt":"2026-09-03T15:01:28.752Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}