{"record":{"id":"c025b34ba71d48ac","repo":"risingwavelabs/risingwave","slug":"error-acquiring-lance-dataset-guard-e","errorCode":null,"errorMessage":"error acquiring lance dataset guard: {e}","messagePattern":"error acquiring lance dataset guard: (.+?)","errorType":"exception","errorClass":"SinkError::LanceDb","httpStatus":null,"severity":"error","filePath":"src/connector/src/sink/lancedb.rs","lineNumber":117,"sourceCode":"    async fn open_table(&self, conn: &LanceDbConnection) -> Result<LanceDbTable> {\n        conn.open_table(&self.table)\n            .execute()\n            .await\n            .context(\"failed to open LanceDB table\")\n            .map_err(SinkError::LanceDb)\n    }\n\n    /// Get the Lance dataset URI from the opened native `LanceDB` table.\n    async fn dataset_uri(&self, table: &LanceDbTable) -> Result<String> {\n        let dataset_wrapper = table.dataset().ok_or_else(|| {\n            SinkError::LanceDb(anyhow!(\n                \"failed to get underlying lance Dataset (table may be remote)\"\n            ))\n        })?;\n        let dataset_guard = dataset_wrapper\n            .get()\n            .await\n            .map_err(|e| SinkError::LanceDb(anyhow!(e)))?;\n        Ok(dataset_guard.uri().to_owned())\n    }\n}\n\n#[serde_as]\n#[derive(Clone, Debug, Deserialize, WithOptions)]\npub struct LanceDbConfig {\n    #[serde(flatten)]\n    pub common: LanceDbCommon,\n\n    pub r#type: String,\n\n    /// Whether to use RisingWave's two-phase commit framework for exactly-once commits.\n    /// Defaults to true. Set to false to use single-phase commits.\n    #[serde_as(as = \"Option<DisplayFromStr>\")]\n    pub is_exactly_once: Option<bool>,\n}\n","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/sink/lancedb.rs#L99-L135","documentation":"RisingWave's LanceDB sink wraps the underlying Lance dataset access in an async guard; if the tokio watch/oneshot handle fails (the dataset holder was dropped or closed), the guard cannot be acquired and the sink fails while resolving the dataset URI. This typically indicates an internal lifecycle problem in the sink writer rather than a user config issue.","triggerScenarios":"Calling LanceDbCommon::dataset_uri (used to resolve the table's storage location) when dataset.get().await fails because the dataset holder task/channel has been dropped or closed before the read completes.","commonSituations":"The sink writer was torn down concurrently (e.g., during failover or sink drop) while another component still tried to read the dataset URI; an internal race during connector shutdown or schema validation.","solutions":["Retry the operation; this is usually a transient lifecycle race during sink restart/failover","Check sink logs for earlier errors that caused the writer/dataset holder to be dropped","Upgrade RisingWave; if reproducible on every start, file a bug with the full log","Verify the sink is not being dropped/deleted concurrently by another session"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match sink_result { Err(e) if e.to_string().contains(\"error acquiring lance dataset guard\") => retry_with_backoff(), Err(e) => fail(e), Ok(v) => v }","preventionTips":["Avoid deleting/dropping the sink while it is actively validating","Check logs for prior writer teardown errors","Retry sink creation on transient failures"],"tags":["rust","lancedb","internal-state"],"backgroundTag":"internal-invariant-violation","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"}