FlowiseAI/Flowise · error · Error
${e}
Error message
${e} What it means
Generic catch-all in the Faiss upsert path covering FaissStore.fromDocuments, path validation/sanitization, vectorStore.save(validatedPath), and the similaritySearchVectorWithScore reassignment. Wraps any failure into a string Error.
Source
Thrown at packages/components/nodes/vectorstores/Faiss/Faiss.ts:103
if (flattenDocs[i] && flattenDocs[i].pageContent) {
finalDocs.push(new Document(flattenDocs[i]))
}
}
try {
const vectorStore = await FaissStore.fromDocuments(finalDocs, embeddings)
// Validate and sanitize the base path to prevent path traversal attacks
const validatedPath = validateVectorStorePath(basePath)
await vectorStore.save(validatedPath)
// Avoid illegal invocation error
vectorStore.similaritySearchVectorWithScore = async (query: number[], k: number) => {
return await similaritySearchVectorWithScore(query, k, vectorStore)
}
return { numAdded: finalDocs.length, addedDocs: finalDocs }
} catch (e) {
throw new Error(e)
}
}
}
async init(nodeData: INodeData): Promise<any> {
const embeddings = nodeData.inputs?.embeddings as Embeddings
const basePath = nodeData.inputs?.basePath as string
const output = nodeData.outputs?.output as string
const topK = nodeData.inputs?.topK as string
const k = topK ? parseFloat(topK) : 4
// Validate and sanitize the base path to prevent path traversal attacks
const validatedPath = validateVectorStorePath(basePath)
const vectorStore = await FaissStore.load(validatedPath, embeddings)
// Avoid illegal invocation error
vectorStore.similaritySearchVectorWithScore = async (query: number[], k: number) => {
return await similaritySearchVectorWithScore(query, k, vectorStore)View on GitHub (pinned to abe4a8601a)
Solutions
- Ensure basePath is within an allowed directory and writable.
- Create the directory if it does not exist before save.
- Confirm the embedding model is reachable.
- Rethrow `e` directly to preserve the underlying filesystem/embedding error.
Example fix
// before
} catch (e) {
throw new Error(e)
}
// after
} catch (e) {
console.error('Faiss upsert/save failed', e)
throw e
} Defensive patterns
Strategy: validation
Validate before calling
import { existsSync, mkdirSync } from 'fs'
import { dirname } from 'path'
const abs = resolve(basePath)
if (!abs.startsWith(ALLOWED_ROOT)) throw new Error('basePath outside allowed root')
if (!existsSync(dirname(abs))) mkdirSync(dirname(abs), { recursive: true })
await vectorStore.save(abs) Type guard
function isWritablePath(p: string): boolean {
try { accessSync(dirname(p), constants.W_OK); return true } catch { return false }
} Try / catch
try {
await vectorStore.save(validatedPath)
} catch (e) {
throw new Error(`Faiss save failed (path=${validatedPath}): ${e instanceof Error ? e.message : e}`)
} Prevention
- Constrain basePath to a known allow-listed root.
- Ensure the parent directory exists and is writable before save.
- Validate embedding outputs before persisting.
When it happens
Trigger: Upsert documents into a Faiss store persisted to basePath. Fails on embedding errors, invalid/traversal-blocked basePath (validateVectorStorePath throws), filesystem permission errors during save, or fromDocuments internal errors.
Common situations: basePath outside allowed root (rejected by validateVectorStorePath), read-only or non-existent directory, embedding model failure, or disk full during save.
Related errors
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/07f5795053a0efd6.
Report an issue: GitHub.