janhq/jan · error · VectorDBError
InvalidInput
InvalidInput
Error message
Invalid input: {0} What it means
VectorDBError::InvalidInput is raised by the vector-db plugin when caller-supplied arguments fail validation before reaching SQLite. The message interpolates the offending value or reason, e.g. 'Invalid input: embedding dimension mismatch'.
Solutions
- Read the interpolated message to see which input was rejected
- Validate vector dimensions match the collection's configured dimension before calling
- Ensure query strings and IDs are non-empty and correctly typed in the Tauri invoke payload
- Fix the frontend to omit undefined fields rather than sending empty values
Example fix
// before
invoke('vector_search', { query: text, vector: embedding });
// after
if (!text || embedding.length !== expectedDim) throw new Error('invalid search input');
invoke('vector_search', { query: text, vector: embedding }); Defensive patterns
Strategy: validation
Validate before calling
function validateSearchInput(text: string, vector: number[], dim: number): string | null {
if (!text.trim()) return 'empty query';
if (vector.length !== dim) return `dim mismatch: ${vector.length} != ${dim}`;
return null;
} Type guard
function isValidVector(v: unknown, dim: number): v is number[] {
return Array.isArray(v) && v.length === dim && v.every((n) => typeof n === 'number' && Number.isFinite(n));
} Prevention
- Validate vector dimensions against the collection config before invoking
- Reject empty strings/IDs on the client before the Tauri call
- Use the same embedding model for index and query
- Serialize payloads with explicit types (no undefined fields)
When it happens
Trigger: Calling a plugin command with an empty query string, a vector whose dimension does not match the stored collection, or out-of-range parameters (limit <= 0, malformed JSON payload).
Common situations: Client sends embeddings computed with a different model than the collection was built with; empty search text; frontend passing undefined/null fields that serialize as empty strings.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
AI-assisted analysis of janhq/jan@7205d770c1 (2026-09-17).
Data as JSON: /api/errors/e0195fe09b721a03.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/plugins/tauri-plugin-vector-db/src/error.rs:8
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)