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 S3 file-read fallback path. After the primary key is not found, the provider attempts a legacy key layout (without orgId); if that fallback GetObject also fails, the error is replaced with an explicit not-found message naming the fileName.
Source
Thrown at packages/components/src/storage/S3StorageProvider.ts:328
// Delete the old file
await this.s3Client.send(
new DeleteObjectsCommand({
Bucket: this.bucket,
Delete: {
Objects: [{ Key: fallbackKey }],
Quiet: false
}
})
)
// Check if the directory is empty and delete recursively if needed
await this.cleanEmptyS3Folders(chatflowId)
return fileContent
}
} catch (fallbackError) {
throw new Error(`File ${fileName} not found`)
}
}
}
async getFilesListFromStorage(...paths: string[]): Promise<FileInfo[]> {
let Key = paths.reduce((acc, cur) => acc + '/' + cur, '')
if (Key.startsWith('/')) {
Key = Key.substring(1)
}
const listCommand = new ListObjectsV2Command({
Bucket: this.bucket,
Prefix: Key
})
const list = await this.s3Client.send(listCommand)
if (list.Contents && list.Contents.length > 0) {
return list.Contents.map((item) => ({View on GitHub (pinned to abe4a8601a)
Solutions
- Confirm the object exists in the bucket under both candidate key layouts.
- Return 404 to the client, exposing only the fileName.
- Re-upload or restore the object if it was deleted.
Example fix
// before
const data = await provider.streamStorageFile(chatflowId, chatId, fileName, orgId)
// after
try {
const data = 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 s3ObjectExists(client: S3Client, bucket: string, key: string): Promise<boolean> {
try {
await client.send(new HeadObjectCommand({ Bucket: bucket, Key: key }))
return true
} catch { return false }
}
// TOCTOU possible; pair with try-catch Type guard
function isS3NotFound(err: unknown): boolean {
return err instanceof Error && /not found/i.test(err.message)
} Try / catch
try {
const data = 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 S3 not-found to 404 at the controller.
- Confirm the key layout before serving.
- Do not retry a confirmed-missing object.
When it happens
Trigger: Requesting a file whose object does not exist under either the orgId-scoped key or the legacy key layout. The throw is at S3StorageProvider.ts:327 inside `catch (fallbackError)`.
Common situations: The object was deleted or never uploaded; orgId migration moved it to a different key; eventual-consistency delay after a delete/upload.
Related errors
- S3 storage configuration is missing
- File ${fileName} not found
- File ${fileName} not found
- Failed to download file ${key} from S3 bucket ${bucketName}:
- Failed to load data from bucket ${bucketName}: ${e.message}
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/02b7d03920f0b8d0.
Report an issue: GitHub.