{"record":{"id":"bcf7c71ff0fba804","repo":"FlowiseAI/Flowise","slug":"failed-to-load-s3-document-error-message","errorCode":null,"errorMessage":"Failed to load S3 document: ${error.message}","messagePattern":"Failed to load S3 document: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/documentloaders/S3File/S3File.ts","lineNumber":703,"sourceCode":"                                  omitMetadataKeys\n                              )\n                }))\n            } else {\n                docs = docs.map((doc) => ({\n                    ...doc,\n                    metadata:\n                        _omitMetadataKeys === '*'\n                            ? {}\n                            : omit(\n                                  {\n                                      ...doc.metadata\n                                  },\n                                  omitMetadataKeys\n                              )\n                }))\n            }\n        } catch (error) {\n            throw new Error(`Failed to load S3 document: ${error.message}`)\n        }\n\n        if (output === 'document') {\n            return docs\n        } else {\n            let finaltext = ''\n            for (const doc of docs) {\n                finaltext += `${doc.pageContent}\\n`\n            }\n            return handleEscapeCharacters(finaltext, false)\n        }\n    }\n\n    private async processWithUnstructured(\n        nodeData: INodeData,\n        options: ICommonObject,\n        bucketName: string,\n        keyName: string,","sourceCodeStart":685,"sourceCodeEnd":721,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/documentloaders/S3File/S3File.ts#L685-L721","documentation":"Top-level catch-all for S3File.init wrapping any error during the single-file S3 load (download, unstructured parse, splitting, metadata). Interpolates the inner error message and loses the original stack (no cause chaining).","triggerScenarios":"Download of the key fails (propagated from [179]); the Unstructured loader API call fails; the document loader for the file type rejects; textSplitter rejects; metadata/omitMetadataKeys processing throws.","commonSituations":"Wrong key name; IAM missing s3:GetObject; Unstructured API URL/key misconfigured; corrupt/unsupported file; bad metadata JSON.","solutions":["Read the inner message to identify the failing stage.","Verify the key exists and IAM has s3:GetObject.","Confirm the Unstructured API URL and key are valid if using unstructured parsing.","Validate metadata/omitMetadataKeys inputs.","Re-throw with { cause: error }."],"exampleFix":"// before\n} catch (error) {\n  throw new Error(`Failed to load S3 document: ${error.message}`)\n}\n// after\n} catch (error) {\n  throw new Error(`Failed to load S3 document: ${error instanceof Error ? error.message : String(error)}`, { cause: error })\n}","handlingStrategy":"try-catch","validationCode":"async function verifyS3ObjectExists(s3Client, bucket, key) {\n  await s3Client.send(new (require('@aws-sdk/client-s3').HeadObjectCommand)({ Bucket: bucket, Key: key }))\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await s3FileLoader.init(nodeData, _, options)\n} catch (e) {\n  throw new Error('S3 file load failed in pipeline', { cause: e })\n}","preventionTips":["Confirm the key exists with a HeadObject pre-check.","Verify IAM s3:GetObject and bucket region.","Validate the Unstructured API URL/key if used.","Validate metadata/omitMetadataKeys inputs."],"tags":["s3","aws-sdk","error-wrapping","unstructured","metadata"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}