{"record":{"id":"8849a2e574614355","repo":"FlowiseAI/Flowise","slug":"failed-to-load-data-from-bucket-bucketname-e","errorCode":null,"errorMessage":"Failed to load data from bucket ${bucketName}: ${e.message}","messagePattern":"Failed to load data from bucket (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/documentloaders/S3Directory/S3Directory.ts","lineNumber":287,"sourceCode":"                    '.swift': (path) => new TextLoader(path), // Swift\n                    '.markdown': (path) => new TextLoader(path), // Markdown\n                    '.md': (path) => new TextLoader(path), // Markdown\n                    '.tex': (path) => new TextLoader(path), // LaTeX\n                    '.ltx': (path) => new TextLoader(path), // LaTeX\n                    '.html': (path) => new TextLoader(path), // HTML\n                    '.vb': (path) => new TextLoader(path), // Visual Basic\n                    '.xml': (path) => new TextLoader(path) // XML\n                },\n                true\n            )\n\n            let docs = await handleDocumentLoaderDocuments(loader, textSplitter)\n\n            docs = handleDocumentLoaderMetadata(docs, _omitMetadataKeys, metadata)\n\n            return handleDocumentLoaderOutput(docs, output)\n        } catch (e: any) {\n            throw new Error(`Failed to load data from bucket ${bucketName}: ${e.message}`)\n        } finally {\n            // remove the temp directory before returning docs\n            fsDefault.rmSync(tempDir, { recursive: true })\n        }\n    }\n}\nmodule.exports = { nodeClass: S3_DocumentLoaders }\n","sourceCodeStart":269,"sourceCodeEnd":295,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/documentloaders/S3Directory/S3Directory.ts#L269-L295","documentation":"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).","triggerScenarios":"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.","commonSituations":"Wrong bucket name/region; IAM missing s3:ListBucket; a corrupt file inside the directory; bad metadata JSON; region mismatch in s3Config.","solutions":["Read the inner message — it indicates which stage failed (list vs download vs parse).","Verify bucket name, region, and IAM s3:ListBucket + s3:GetObject permissions.","Ensure files in the bucket are of supported types (see DirectoryLoader map) and not corrupt.","Validate the metadata/omitMetadataKeys inputs.","Re-throw with { cause: error } to preserve the stack."],"exampleFix":"// before\n} catch (e: any) {\n  throw new Error(`Failed to load data from bucket ${bucketName}: ${e.message}`)\n} finally {\n  fsDefault.rmSync(tempDir, { recursive: true })\n}\n// after\n} catch (e: any) {\n  throw new Error(`Failed to load data from bucket ${bucketName}: ${e.message}`, { cause: e })\n} finally {\n  fsDefault.rmSync(tempDir, { recursive: true })\n}","handlingStrategy":"try-catch","validationCode":"async function verifyBucketAndPrefix(s3Client, bucket, prefix) {\n  const out = await s3Client.send(new (require('@aws-sdk/client-s3').ListObjectsV2Command)({ Bucket: bucket, Prefix: prefix, MaxKeys: 1 }))\n  if (!(out.Contents && out.Contents.length)) throw new Error(`No objects found under s3://${bucket}/${prefix}`)\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await s3DirLoader.init(nodeData, _, options)\n} catch (e) {\n  throw new Error('S3 directory load failed in pipeline', { cause: e })\n}","preventionTips":["Verify bucket name, region, and IAM s3:ListBucket + s3:GetObject.","Confirm files are supported types and not corrupt.","Validate metadata/omitMetadataKeys inputs before runtime.","Inspect the inner message to localize the failing stage."],"tags":["s3","aws-sdk","directory-loader","error-wrapping","cleanup"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}