FlowiseAI/Flowise · error · Error
File ${fileName} not found
Error message
File ${fileName} not found What it means
Re-thrown inside the catch block of the GCS file-read fallback path. After the primary object key is not found, the provider tries a legacy key layout (without orgId); if that fallback read also fails, the original/any error is swallowed and replaced with this explicit not-found message.
Source
Thrown at packages/components/src/storage/GCSStorageProvider.ts:232
if (buffer) {
const file = this.bucket.file(filePath)
await new Promise<void>((resolve, reject) => {
file.createWriteStream()
.on('error', (err) => reject(err))
.on('finish', () => resolve())
.end(buffer)
})
// Delete the old file
await fallbackFile.delete()
// Check if the directory is empty and delete recursively if needed
await this.cleanEmptyGCSFolders(normalizedChatflowId)
return buffer
}
} catch (fallbackError) {
throw new Error(`File ${fileName} not found`)
}
}
}
async getFilesListFromStorage(...paths: string[]): Promise<FileInfo[]> {
const normalizedPaths = paths.map((p) => this.normalizePath(p))
const prefix = normalizedPaths.join('/')
const [files] = await this.bucket.getFiles({ prefix })
return files.map((file) => ({
name: file.name.split('/').pop() || '',
path: file.name,
size: typeof file.metadata.size === 'string' ? parseInt(file.metadata.size, 10) || 0 : file.metadata.size || 0
}))
}
async removeFilesFromStorage(...paths: string[]): Promise<StorageSizeResult> {View on GitHub (pinned to abe4a8601a)
Solutions
- Verify the file exists in the bucket with the expected key (orgId/chatflowId/chatId/name and the legacy chatflowId/chatId/name).
- Return a 404 to the client and surface only the fileName, not internal key details.
- Re-upload or restore the object if it was deleted.
Example fix
// before
const buf = await provider.streamStorageFile(chatflowId, chatId, fileName, orgId)
// after
try {
const buf = 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
async function gcsFileExists(bucket: Bucket, key: string): Promise<boolean> {
const [exists] = await bucket.file(key).exists()
return exists
}
// note: existence can change between check and read (TOCTOU); pair with try-catch Type guard
function isNotFound(err: unknown): boolean {
return err instanceof Error && /File .* not found/i.test(err.message)
} Try / catch
try {
const buf = 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
- Map not-found errors to 404 at the controller.
- Confirm the object key layout (orgId-scoped vs legacy) before serving.
- Do not retry indefinitely on a confirmed missing object.
When it happens
Trigger: Requesting a file whose blob does not exist under either the orgId-scoped key or the legacy key layout. The throw is at GCSStorageProvider.ts:231 inside `catch (fallbackError)`.
Common situations: The file was deleted or never uploaded; the orgId migration left the blob under a different key; requesting a file immediately after upload before GCS consistency reflects it.
Related errors
- GOOGLE_CLOUD_STORAGE_BUCKET_NAME env variable is required
- File ${fileName} not found
- 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/82d8c38deeda2972.
Report an issue: GitHub.