FlowiseAI/Flowise · error · Error
File ${fileName} not found
Error message
File ${fileName} not found What it means
Thrown by LocalStorageProvider.streamStorageFile when the file does not exist at the primary path (orgId/chatflowId/chatId/name) and also does not exist at the legacy fallback path (chatflowId/chatId/name). It signals a genuine on-disk miss after the migration fallback was attempted.
Source
Thrown at packages/components/src/storage/LocalStorageProvider.ts:165
if (fs.existsSync(fallbackPath)) {
// Create directory if it doesn't exist
const dir = path.dirname(filePath)
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true })
}
// Copy file to correct location with orgId
fs.copyFileSync(fallbackPath, filePath)
// Delete the old file
fs.unlinkSync(fallbackPath)
// Clean up empty directories recursively
this.cleanEmptyLocalFolders(path.dirname(fallbackPath))
return fs.createReadStream(filePath)
} else {
throw new Error(`File ${fileName} not found`)
}
}
}
async getFilesListFromStorage(...paths: string[]): Promise<FileInfo[]> {
const directory = this.buildPath(...paths)
return this.getFilePaths(directory)
}
private getFilePaths(dir: string): FileInfo[] {
let results: FileInfo[] = []
const readDirectory = (directory: string) => {
try {
if (!fs.existsSync(directory)) {
console.warn(`Directory does not exist: ${directory}`)
return
}View on GitHub (pinned to abe4a8601a)
Solutions
- Verify the file exists on disk under the expected path layout before serving.
- Return 404 to the client and avoid leaking internal paths.
- Re-upload the file or correct the orgId/chatflowId/chatId used in the request.
Example fix
// before
const stream = await provider.streamStorageFile(chatflowId, chatId, fileName, orgId)
// after
try {
const stream = await provider.streamStorageFile(chatflowId, chatId, fileName, orgId)
} catch (e) {
if (/not found/i.test(e.message)) return res.status(404).send('file not found')
throw e
} Defensive patterns
Strategy: try-catch
Validate before calling
function localFileExists(p: string): boolean {
try { return fs.existsSync(p) } catch { return false }
}
// existence may change between check and read; pair with try-catch Type guard
function isLocalNotFound(err: unknown): boolean {
return err instanceof Error && /not found/i.test(err.message)
} Try / catch
try {
const stream = await provider.streamStorageFile(chatflowId, chatId, fileName, orgId)
} catch (e) {
if (e instanceof Error && /not found/i.test(e.message)) return res.status(404).send('file not found')
throw e
} Prevention
- Return 404 for missing local files.
- Verify the expected path layout before serving.
- Avoid retrying a confirmed-missing file.
When it happens
Trigger: Requesting a file that was never written, was deleted, or whose fallback migration already moved it. The throw is at LocalStorageProvider.ts:165 in the final else branch.
Common situations: Stale attachment references; files removed by cleanup; race between upload and read; wrong orgId scoping.
Related errors
- File ${fileName} not found
- Invalid file path
- File ${fileName} not found
- AZURE_BLOB_STORAGE_CONTAINER_NAME env variable is required
- Azure Blob Storage configuration is missing. Provide AZURE_B
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/48d649a625c8d354.
Report an issue: GitHub.