{"record":{"id":"0d005df0ea14f6d9","repo":"zed-industries/zed","slug":"queues-are-inserted-when-build-is-called-this-sho","errorCode":null,"errorMessage":"Queues are inserted when build is called. This should always succeed","messagePattern":"Queues are inserted when build is called\\. This should always succeed","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/sqlez/src/thread_safe_connection.rs","lineNumber":177,"sourceCode":"    fn open_file(uri: &str) -> Connection {\n        Connection::open_file(uri)\n    }\n\n    /// Opens a shared memory connection using the file path as the identifier. This is internal\n    /// and only called from the deref function.\n    fn open_shared_memory(uri: &str) -> Connection {\n        Connection::open_memory(Some(uri))\n    }\n\n    pub fn write<T: 'static + Send + Sync>(\n        &self,\n        callback: impl 'static + Send + FnOnce(&Connection) -> T,\n    ) -> impl Future<Output = T> {\n        // Check and invalidate queue and maybe recreate queue\n        let queues = QUEUES.read();\n        let write_channel = queues\n            .get(&self.uri)\n            .expect(\"Queues are inserted when build is called. This should always succeed\");\n\n        // Create a one shot channel for the result of the queued write\n        // so we can await on the result\n        let (sender, receiver) = oneshot::channel();\n\n        let thread_safe_connection = (*self).clone();\n        write_channel(Box::new(move || {\n            let connection = thread_safe_connection.deref();\n            let result = connection.with_write(|connection| callback(connection));\n            sender.send(result).ok();\n        }));\n        receiver.map(|response| response.expect(\"Write queue unexpectedly closed\"))\n    }\n\n    pub(crate) fn create_connection(\n        persistent: bool,\n        uri: &str,\n        connection_initialize_query: Option<&'static str>,","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/sqlez/src/thread_safe_connection.rs#L159-L195","documentation":"The thread-safe connection write path asserts its write queue exists in the global QUEUES map; it is inserted when build() is called, so a missing entry means write() was invoked on a connection whose queue was never registered or was invalidated without recreation.","triggerScenarios":"Thrown at crates/sqlez/src/thread_safe_connection.rs:177 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure build() always runs before any write on the connection","Recreate the queue after invalidation instead of assuming presence","Use queues.get().ok_or() and surface a proper error"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}