FlowiseAI/Flowise · error · Error

Failed to load data from bucket ${bucketName}: ${e.message}

Error message

Failed to load data from bucket ${bucketName}: ${e.message}

What it means

Top-level catch-all for S3Directory.init wrapping any error from listing, downloading, splitting, or metadata processing for the whole bucket load. Interpolates the inner error message and runs in a try/finally that always removes tempDir. Original stack is dropped (no cause chaining).

Source

Thrown at packages/components/nodes/documentloaders/S3Directory/S3Directory.ts:287

                    '.swift': (path) => new TextLoader(path), // Swift
                    '.markdown': (path) => new TextLoader(path), // Markdown
                    '.md': (path) => new TextLoader(path), // Markdown
                    '.tex': (path) => new TextLoader(path), // LaTeX
                    '.ltx': (path) => new TextLoader(path), // LaTeX
                    '.html': (path) => new TextLoader(path), // HTML
                    '.vb': (path) => new TextLoader(path), // Visual Basic
                    '.xml': (path) => new TextLoader(path) // XML
                },
                true
            )

            let docs = await handleDocumentLoaderDocuments(loader, textSplitter)

            docs = handleDocumentLoaderMetadata(docs, _omitMetadataKeys, metadata)

            return handleDocumentLoaderOutput(docs, output)
        } catch (e: any) {
            throw new Error(`Failed to load data from bucket ${bucketName}: ${e.message}`)
        } finally {
            // remove the temp directory before returning docs
            fsDefault.rmSync(tempDir, { recursive: true })
        }
    }
}
module.exports = { nodeClass: S3_DocumentLoaders }

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Read the inner message — it indicates which stage failed (list vs download vs parse).
  2. Verify bucket name, region, and IAM s3:ListBucket + s3:GetObject permissions.
  3. Ensure files in the bucket are of supported types (see DirectoryLoader map) and not corrupt.
  4. Validate the metadata/omitMetadataKeys inputs.
  5. Re-throw with { cause: error } to preserve the stack.

Example fix

// before
} catch (e: any) {
  throw new Error(`Failed to load data from bucket ${bucketName}: ${e.message}`)
} finally {
  fsDefault.rmSync(tempDir, { recursive: true })
}
// after
} catch (e: any) {
  throw new Error(`Failed to load data from bucket ${bucketName}: ${e.message}`, { cause: e })
} finally {
  fsDefault.rmSync(tempDir, { recursive: true })
}
Defensive patterns

Strategy: try-catch

Validate before calling

async function verifyBucketAndPrefix(s3Client, bucket, prefix) {
  const out = await s3Client.send(new (require('@aws-sdk/client-s3').ListObjectsV2Command)({ Bucket: bucket, Prefix: prefix, MaxKeys: 1 }))
  if (!(out.Contents && out.Contents.length)) throw new Error(`No objects found under s3://${bucket}/${prefix}`)
}

Try / catch

try {
  return await s3DirLoader.init(nodeData, _, options)
} catch (e) {
  throw new Error('S3 directory load failed in pipeline', { cause: e })
}

Prevention

When it happens

Trigger: ListObjectsV2 fails (NoSuchBucket, access denied); any per-key download error propagated from [176]; DirectoryLoader fails on an unsupported/corrupt file; textSplitter rejects; handleDocumentLoaderMetadata throws on bad omitMetadataKeys.

Common situations: Wrong bucket name/region; IAM missing s3:ListBucket; a corrupt file inside the directory; bad metadata JSON; region mismatch in s3Config.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/8849a2e574614355. Report an issue: GitHub.