janhq/jan · error · VectorDBError
DatabaseError
DatabaseError
Error message
Database error: {0} What it means
VectorDBError::DatabaseError is the catch-all variant of the vector-db plugin's error enum. It wraps any underlying database failure (typically a rusqlite::Error converted via the From impl) into a string message prefixed with 'Database error:'. It is thrown whenever a SQLite operation in the plugin fails.
Solutions
- Inspect the wrapped string (the rusqlite error text) to identify the exact SQLite failure
- Verify the database file path exists and its parent directory is writable
- Check no other process holds a write lock on the SQLite file
- If a schema mismatch, delete/migrate the DB file so the plugin can recreate it
Example fix
// before
let conn = Connection::open(path)?;
// after
if let Some(dir) = std::path::Path::new(&path).parent() {
std::fs::create_dir_all(dir)?; // ensure parent exists before opening
}
let conn = Connection::open(path).map_err(|e| VectorDBError::DatabaseError(e.to_string()))?; Defensive patterns
Strategy: try-catch
Validate before calling
import std::path::Path;
if !Path::new(&db_path).parent().map_or(false, |p| p.exists()) {
std::fs::create_dir_all(Path::new(&db_path).parent().unwrap())?;
} Try / catch
match plugin_command() {
Err(VectorDBError::DatabaseError(msg)) => { log::error!("db failure: {msg}"); /* retry or surface to UI */ }
other => other?,
} Prevention
- Ensure the DB directory exists and is writable before opening
- Enable WAL mode to reduce lock contention
- Wrap rusqlite calls with busy_timeout
- Log the wrapped rusqlite message for actionable diagnostics
When it happens
Trigger: Any rusqlite operation that fails inside the plugin (connection open, query execution, transaction commit) is converted via From<rusqlite::Error> into VectorDBError::DatabaseError(err.to_string()).
Common situations: Corrupt or locked SQLite file, missing database directory, disk-full, schema migration mismatch after a plugin version upgrade, or concurrent writes hitting SQLite's busy lock.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
AI-assisted analysis of janhq/jan@7205d770c1 (2026-09-17).
Data as JSON: /api/errors/36e1b67a9937f826.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/plugins/tauri-plugin-vector-db/src/error.rs:5
use serde::{Deserialize, Serialize};
#[derive(Debug, thiserror::Error, Serialize, Deserialize)]
pub enum VectorDBError {
#[error("Database error: {0}")]
DatabaseError(String),
#[error("Invalid input: {0}")]
InvalidInput(String),
}
impl From<rusqlite::Error> for VectorDBError {
fn from(err: rusqlite::Error) -> Self {
VectorDBError::DatabaseError(err.to_string())
}
}
impl From<serde_json::Error> for VectorDBError {
fn from(err: serde_json::Error) -> Self {
VectorDBError::DatabaseError(err.to_string())
}
}
View on GitHub (pinned to 7205d770c1)