{"record":{"id":"e0195fe09b721a03","repo":"janhq/jan","slug":"invalidinput","errorCode":"InvalidInput","errorMessage":"Invalid input: {0}","messagePattern":"Invalid input: (.+?)","errorType":"error_code","errorClass":"VectorDBError","httpStatus":null,"severity":"error","filePath":"src-tauri/plugins/tauri-plugin-vector-db/src/error.rs","lineNumber":8,"sourceCode":"use serde::{Deserialize, Serialize};\n\n#[derive(Debug, thiserror::Error, Serialize, Deserialize)]\npub enum VectorDBError {\n    #[error(\"Database error: {0}\")]\n    DatabaseError(String),\n\n    #[error(\"Invalid input: {0}\")]\n    InvalidInput(String),\n}\n\nimpl From<rusqlite::Error> for VectorDBError {\n    fn from(err: rusqlite::Error) -> Self {\n        VectorDBError::DatabaseError(err.to_string())\n    }\n}\n\nimpl From<serde_json::Error> for VectorDBError {\n    fn from(err: serde_json::Error) -> Self {\n        VectorDBError::DatabaseError(err.to_string())\n    }\n}\n\n","sourceCodeStart":1,"sourceCodeEnd":24,"githubUrl":"https://github.com/janhq/jan/blob/7205d770c1e097c3daf35a911176410e93bc5564/src-tauri/plugins/tauri-plugin-vector-db/src/error.rs#L1-L24","documentation":"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'.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\ninvoke('vector_search', { query: text, vector: embedding });\n// after\nif (!text || embedding.length !== expectedDim) throw new Error('invalid search input');\ninvoke('vector_search', { query: text, vector: embedding });","handlingStrategy":"validation","validationCode":"function validateSearchInput(text: string, vector: number[], dim: number): string | null {\n  if (!text.trim()) return 'empty query';\n  if (vector.length !== dim) return `dim mismatch: ${vector.length} != ${dim}`;\n  return null;\n}","typeGuard":"function isValidVector(v: unknown, dim: number): v is number[] {\n  return Array.isArray(v) && v.length === dim && v.every((n) => typeof n === 'number' && Number.isFinite(n));\n}","tryCatchPattern":null,"preventionTips":["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)"],"tags":["validation","input-validation","rust","tauri-plugin"],"backgroundTag":"invalid-argument-value","analyzedSha":"7205d770c1e097c3daf35a911176410e93bc5564","analyzedAt":"2026-09-17T14:27:30.100Z","contentChangedAt":"2026-09-17T14:27:30.100Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}