t8y2/dbx · error
SQLite restore failed: {error}
Error message
SQLite restore failed: {error} What it means
Returned by restore in the sqlite worker when restoring the database from a source (conn.restore of DatabaseName::Main) fails — the source file is not a valid SQLite backup, is locked, or the restore API errored. The source path was already validated as non-empty/NUL-free; this is the engine-level restore failure with the rusqlite error embedded.
Source
Thrown at crates/dbx-sqlite-worker/src/runtime.rs:221
if !parent.as_os_str().is_empty() {
if let Err(error) = std::fs::create_dir_all(parent) {
return WorkerBody::err(error.to_string());
}
}
}
match conn.backup(DatabaseName::Main, dest, None) {
Ok(()) => WorkerBody::ok(),
Err(error) => WorkerBody::err(format!("SQLite backup failed: {error}")),
}
}
fn restore(conn: &mut Connection, src: &str) -> WorkerBody {
if src.trim().is_empty() || src.contains('\0') {
return WorkerBody::err("Restore source is invalid");
}
match conn.restore(DatabaseName::Main, src, None::<fn(_)>) {
Ok(()) => WorkerBody::ok(),
Err(error) => WorkerBody::err(format!("SQLite restore failed: {error}")),
}
}
fn value_to_json(value: rusqlite::types::ValueRef<'_>, column_decl_type: Option<&str>) -> (serde_json::Value, bool) {
match value {
rusqlite::types::ValueRef::Null => (json!(null), false),
rusqlite::types::ValueRef::Integer(value) => (json!(value), false),
rusqlite::types::ValueRef::Real(value) => (json!(value), false),
rusqlite::types::ValueRef::Text(value) => (json!(String::from_utf8_lossy(value)), false),
rusqlite::types::ValueRef::Blob(value) => sqlite_blob_value_to_json(value, column_decl_type),
}
}
fn sqlite_blob_value_to_json(bytes: &[u8], column_decl_type: Option<&str>) -> (serde_json::Value, bool) {
if is_sqlite_text_affinity(column_decl_type) {
if let Ok(text) = std::str::from_utf8(bytes) {
return (json!(text), false);
}View on GitHub (pinned to c0390bff16)
Solutions
- Verify the source file is a valid SQLite database backup (sqlite3 source .recover / integrity_check)
- Ensure the source file is readable and not locked by another process
- Check disk space and permissions on the target database path
- Retry after closing other connections to the target database
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at crates/dbx-sqlite-worker/src/runtime.rs:221 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/d985e8522a90bbe4.
Report an issue: GitHub.