{"record":{"id":"330a9fe00c7e9272","repo":"appsmithorg/appsmith","slug":"pe-as3-5000","errorCode":"PE-AS3-5000","errorMessage":"Appsmith server has encountered an unexpected error when fetching file content from AWS S3 server. Please reach out to Appsmith customer support to resolve this.","messagePattern":"Appsmith server has encountered an unexpected error when fetching file content from AWS S3 server\\. Please reach out to Appsmith customer support to resolve this\\.","errorType":"error_code","errorClass":"AppsmithPluginException","httpStatus":500,"severity":"error","filePath":"app/server/appsmith-plugins/amazons3Plugin/src/main/java/com/external/plugins/AmazonS3Plugin.java","lineNumber":151,"sourceCode":"\n        static {\n            try {\n                amazonS3ErrorUtils = AmazonS3ErrorUtils.getInstance();\n            } catch (InstantiationException e) {\n                throw new RuntimeException(e);\n            }\n        }\n\n        public S3PluginExecutor() {\n            this.filterDataService = FilterDataService.getInstance();\n        }\n\n        /*\n         * - Exception thrown by this method is expected to be handled by the caller.\n         */\n        ArrayList<String> getFilenamesFromObjectListing(ObjectListing objectListing) throws AppsmithPluginException {\n            if (objectListing == null) {\n                throw new AppsmithPluginException(\n                        S3PluginError.AMAZON_S3_QUERY_EXECUTION_FAILED,\n                        S3ErrorMessages.FILE_CONTENT_FETCHING_ERROR_MSG);\n            }\n\n            ArrayList<String> result = new ArrayList<>();\n            List<S3ObjectSummary> objects = objectListing.getObjectSummaries();\n            for (S3ObjectSummary os : objects) {\n                result.add(os.getKey());\n            }\n\n            return result;\n        }\n\n        /*\n         * - Exception thrown by this method is expected to be handled by the caller.\n         */\n        ArrayList<String> listAllFilesInBucket(AmazonS3 connection, String bucketName, String prefix)\n                throws AppsmithPluginException {","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/appsmithorg/appsmith/blob/8cd9021c24cdbea1c3c12c966073708e83db60c2/app/server/appsmith-plugins/amazons3Plugin/src/main/java/com/external/plugins/AmazonS3Plugin.java#L133-L169","documentation":"S3 plugin error (`AMAZON_S3_QUERY_EXECUTION_FAILED`, PE-AS3-5000) from `getFilenamesFromObjectListing`: the `ObjectListing` passed in is null. The method exists to extract object keys from a list-objects result, and a null listing is treated as an unexpected, unrecoverable state - hence the 'contact support' wording. The message text says 'fetching file content' but the method actually lists file keys.","triggerScenarios":"`AmazonS3.listObjects(...)` or `listNextBatchOfObjects(...)` returned null (the AWS SDK normally never returns null here), so the value flowed into `getFilenamesFromObjectListing`.","commonSituations":"A mocked/stubbed S3 client in tests returning null; an AWS SDK version mismatch where a listing call unexpectedly returns null; a custom S3-compatible provider whose SDK response deviates from AWS.","solutions":["Check that the S3 connection and bucket are valid (see error 119) - a broken connection can surface as a null listing downstream.","If you control the client, ensure `listObjects`/`listNextBatchOfObjects` never return null.","Report to Appsmith support if this occurs against real AWS S3 with no other symptoms."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"ObjectListing listing = connection.listObjects(bucketName, prefix);\nif (listing == null) {\n    log.error(\"S3 listObjects returned null for bucket={}, prefix={}\", bucketName, prefix);\n    return Collections.emptyList(); // or throw a domain-specific error\n}\nreturn getFilenamesFromObjectListing(listing);","typeGuard":"private static boolean hasValidListing(ObjectListing listing) {\n    return listing != null && listing.getObjectSummaries() != null;\n}","tryCatchPattern":"try {\n    return s3Executor.listAllFilesInBucket(connection, bucketName, prefix);\n} catch (AppsmithPluginException e) {\n    if (\"PE-AS3-5000\".equals(e.getAppErrorCode())\n            && e.getMessage().contains(\"fetching file content\")) {\n        log.warn(\"S3 returned null listing for bucket={}, retrying\", bucketName);\n        return s3Executor.listAllFilesInBucket(rebuildConnection(), bucketName, prefix);\n    }\n    throw e;\n}","preventionTips":["Null-check the ObjectListing before passing it to getFilenamesFromObjectListing.","Validate the datasource connection first (error 119) so listing calls have a healthy client.","If mocking S3 in tests, never return null from listObjects."],"tags":["appsmith","s3","aws","object-listing","null-check"],"backgroundTag":null,"analyzedSha":"8cd9021c24cdbea1c3c12c966073708e83db60c2","analyzedAt":"2026-08-12T22:14:19.293Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}