{"record":{"id":"cbdcfe5b0af73a82","repo":"pentaho/pentaho-kettle","slug":"exception-getting-the-list-of-buckets","errorCode":null,"errorMessage":"Exception getting the list of buckets ","messagePattern":"Exception getting the list of buckets ","errorType":"exception","errorClass":"FileSystemException","httpStatus":null,"severity":"error","filePath":"plugins/s3-vfs/core/src/main/java/org/pentaho/amazon/s3/provider/S3Provider.java","lineNumber":121,"sourceCode":"\n  /**\n   * Get the list of buckets for a Vfs Connection\n   * @param s3Details\n   * @return\n   * @throws FileSystemException - throws exception whenever there is any exception thrown while doing the listBuckets() call\n   */\n  @Override public List<VFSRoot> getLocations( S3Details s3Details ) throws FileSystemException {\n    List<VFSRoot> buckets = new ArrayList<>();\n    try {\n      AmazonS3 s3 = getS3Client( s3Details );\n      if ( s3 != null ) {\n        for ( Bucket bucket : s3.listBuckets() ) {\n          buckets.add( new VFSRoot( bucket.getName(), bucket.getCreationDate() ) );\n        }\n      }\n    } catch ( Exception e ) {\n      log.logError( \"Exception getting the list of buckets for connection '\" + s3Details.getName() + \"'\", e );\n      throw new FileSystemException( \"Exception getting the list of buckets \", e );\n    }\n    return buckets;\n  }\n\n  @Override\n  public String getName() {\n    return NAME;\n  }\n\n  @Override\n  public String getKey() {\n    return S3FileProvider.SCHEME;\n  }\n\n  @Override public String getProtocol( S3Details s3Details ) {\n    return S3FileProvider.SCHEME;\n  }\n","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/s3-vfs/core/src/main/java/org/pentaho/amazon/s3/provider/S3Provider.java#L103-L139","documentation":"S3Provider.getLocations() wraps any failure while listing the S3 buckets of the configured connection into a Commons VFS FileSystemException with the message 'Exception getting the list of buckets '. The real cause (bad credentials, network failure, missing permissions) is attached as the cause and logged first with the connection name.","triggerScenarios":"Calling getLocations() (e.g. via a VFS root listing or the S3 VFS 'list buckets' action) when s3.listBuckets() throws: invalid/expired AWS credentials, no s3:ListBucket permission, wrong region/endpoint, or network/DNS failure.","commonSituations":"Misconfigured S3 connection in Pentaho/Kettle (bad access key or secret), IAM user without ListAllMyBuckets permission, VPC without internet/NAT access, or AWS outage throttling the request.","solutions":["Verify the AWS access key/secret and region configured on the S3 connection (s3Details).","Grant the IAM user s3:ListAllMyBuckets permission on the account.","Inspect the logged cause (Kettle log line above the exception) to identify the underlying AWS SDK error.","Test connectivity from the host running Pentaho (network/proxy/DNS) to s3.amazonaws.com.","Enable VFS debug logging to capture the full AWS SDK stack trace."],"exampleFix":"// before\nfor ( Bucket bucket : s3.listBuckets() ) { ... }\n// after\ntry {\n  for ( Bucket bucket : s3.listBuckets() ) { ... }\n} catch ( AmazonServiceException e ) {\n  throw new FileSystemException( \"Exception getting the list of buckets: \" + e.getErrorCode(), e );\n}","handlingStrategy":"try-catch","validationCode":"// validate before resolving\nBasicAWSCredentials creds = new BasicAWSCredentials( accessKey, secretKey );\nAmazonS3 probe = AmazonS3ClientBuilder.standard()\n  .withCredentials( new AWSStaticCredentialsProvider( creds ) )\n  .withRegion( region ).build();\nprobe.drain(); // or call probe.listBuckets() and check IAM policy first\nif ( creds == null || accessKey == null || accessKey.isEmpty() ) throw new IllegalArgumentException( \"S3 credentials not configured\" );","typeGuard":null,"tryCatchPattern":"try {\n  List<VFSRoot> locs = provider.getLocations();\n} catch ( FileSystemException e ) {\n  Throwable root = e.getCause(); // AmazonServiceException carries errorCode\n  logger.error( \"Bucket listing failed: {}\", root != null ? root.getMessage() : e.getMessage(), e );\n}","preventionTips":["Validate S3 connection settings with a 'Test connection' action before running pipelines","Apply least-privilege IAM policy including s3:ListAllMyBuckets","Use instance profiles/roles instead of long-lived keys where possible","Monitor AWS SDK error codes in logs for early detection"],"tags":["s3","vfs","aws-credentials","iam-permissions"],"backgroundTag":"api-error-response","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}