{"record":{"id":"26fbb90f5e44c26a","repo":"zeroclaw-labs/zeroclaw","slug":"failed-to-open-device-registry-database","errorCode":null,"errorMessage":"Failed to open device registry database","messagePattern":"Failed to open device registry database","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-gateway/src/api_pairing.rs","lineNumber":42,"sourceCode":"    pub last_seen: DateTime<Utc>,\n    pub ip_address: Option<String>,\n    /// macOS TCC permissions (and equivalent on other OSes) the device reports as granted.\n    /// Pushed by the desktop app via POST /api/devices/me/capabilities.\n    #[serde(default, skip_serializing_if = \"Option::is_none\")]\n    pub capabilities: Option<Vec<String>>,\n}\n\n/// Registry of paired devices backed by SQLite.\n#[derive(Debug)]\npub struct DeviceRegistry {\n    cache: Mutex<HashMap<String, DeviceInfo>>,\n    db_path: PathBuf,\n}\n\nimpl DeviceRegistry {\n    pub fn new(workspace_dir: &Path) -> Self {\n        let db_path = workspace_dir.join(\"devices.db\");\n        let conn = Connection::open(&db_path).expect(\"Failed to open device registry database\");\n        conn.execute_batch(\n            \"PRAGMA journal_mode = WAL;\n             PRAGMA synchronous = NORMAL;\n             PRAGMA temp_store = MEMORY;\n             CREATE TABLE IF NOT EXISTS devices (\n                token_hash TEXT PRIMARY KEY,\n                id TEXT NOT NULL,\n                name TEXT,\n                device_type TEXT,\n                paired_at TEXT NOT NULL,\n                last_seen TEXT NOT NULL,\n                ip_address TEXT,\n                capabilities TEXT\n            )\",\n        )\n        .expect(\"Failed to create devices table\");\n\n        // Additive migration for DBs created before the capabilities column existed.","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-gateway/src/api_pairing.rs#L24-L60","documentation":"Error \"Failed to open device registry database\" thrown in zeroclaw-labs/zeroclaw.","triggerScenarios":"Thrown at crates/zeroclaw-gateway/src/api_pairing.rs:42 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the zeroclaw data directory exists and is writable, then restart the gateway.","Fix filesystem permissions or free disk space if the database file cannot be opened."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}