{"record":{"id":"ab9ee9855bd1d7ee","repo":"pentaho/pentaho-kettle","slug":"vfs-provider-get-type-error","errorCode":"vfs.provider/get-type.error","errorMessage":"vfs.provider/get-type.error","messagePattern":"vfs\\.provider/get-type\\.error","errorType":"error_code","errorClass":"FileSystemException","httpStatus":null,"severity":"error","filePath":"plugins/s3-vfs/core/src/main/java/org/pentaho/s3/vfs/S3FileObject.java","lineNumber":153,"sourceCode":"      injectType( FileType.FOLDER );\n    } catch ( AmazonS3Exception e2 ) {\n      ListObjectsRequest listObjectsRequest = new ListObjectsRequest()\n              .withBucketName( newPath.getValue() )\n              .withPrefix( keyWithDelimiter )\n              .withDelimiter( DELIMITER );\n      ObjectListing ol = fileSystem.getS3Client().listObjects( listObjectsRequest );\n\n      if ( !( ol.getCommonPrefixes().isEmpty() && ol.getObjectSummaries().isEmpty() ) ) {\n        injectType( FileType.FOLDER );\n      } else {\n        //Folders don't really exist - they will generate a \"NoSuchKey\" exception\n        String errorCode = e2.getErrorCode();\n        // confirms key doesn't exist but connection okay\n        if ( !errorCode.equals( \"NoSuchKey\" ) ) {\n          // bubbling up other connection errors\n          logger.error( \"Could not get information on \" + getQualifiedName(),\n                  e2 ); // make sure this gets printed for the user\n          throw new FileSystemException( \"vfs.provider/get-type.error\", getQualifiedName(), e2 );\n        }\n      }\n    }\n  }\n\n  // See if the first name on the path is actually a bucket.  If not, it's probably an old-style path.\n  protected SimpleEntry<String, String> fixFilePath( String key, String bucket ) {\n    String newBucket = bucket;\n    String newKey = key;\n\n    //see if the folder exists; if not, it might be from an old path and the real bucket is in the key\n    if ( !bucketExists( bucket ) ) {\n      logger.warn( \"Bucket {} from original path not found, might be an old path from the old driver\", bucket );\n      if ( key.split( DELIMITER ).length > 1 ) {\n        newBucket = key.split( DELIMITER )[0];\n        newKey = key.replaceFirst( newBucket + DELIMITER, \"\" );\n      } else {\n        newBucket = key;","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/s3-vfs/core/src/main/java/org/pentaho/s3/vfs/S3FileObject.java#L135-L171","documentation":"S3FileObject.handleAttachException() resolves the file's type during attach. When the underlying S3 getObjectMetadata call fails with an error code other than 'NoSuchKey' (i.e. the connection itself failed), it throws FileSystemException('vfs.provider/get-type.error', qualifiedName, cause). NoSuchKey is treated as 'file does not exist'; everything else is a real connectivity or permissions problem.","triggerScenarios":"Attaching (resolving) an S3 VFS file when S3 returns an error code other than NoSuchKey: AccessDenied, InvalidAccessKeyId, network timeout, 403 from a missing bucket, or wrong endpoint/region.","commonSituations":"Bucket name typo (bucket resolves to another account → 403), IAM policy lacking s3:GetObject, expired session credentials, or S3 VFS used with a path in a nonexistent bucket.","solutions":["Read the logged AWS error code to identify the exact S3 failure.","Verify the bucket name and that it belongs to your account (403 is returned for foreign buckets).","Grant the IAM user s3:GetObject / s3:ListBucket on the bucket.","Check credentials validity and region/endpoint configuration.","Retry on transient 5xx/network codes."],"exampleFix":"// before\nif ( !errorCode.equals( \"NoSuchKey\" ) ) {\n  throw new FileSystemException( \"vfs.provider/get-type.error\", getQualifiedName(), e2 );\n}\n// after\nif ( !errorCode.equals( \"NoSuchKey\" ) ) {\n  if ( errorCode.startsWith( \"Internal\" ) || errorCode.equals( \"RequestTimeout\" ) ) {\n    // retry transient failures\n    retryAttach();\n  } else {\n    throw new FileSystemException( \"vfs.provider/get-type.error\", getQualifiedName(), e2 );\n  }\n}","handlingStrategy":"try-catch","validationCode":"// check bucket exists/accessible before resolving files\ntry {\n  s3.headBucket( new HeadBucketRequest( bucketName ) );\n} catch ( AmazonServiceException e ) {\n  throw new IllegalStateException( \"Bucket inaccessible: \" + bucketName + \" code=\" + e.getErrorCode() );\n}","typeGuard":null,"tryCatchPattern":"try {\n  FileObject fo = fs.resolveFile( \"s3://bucket/key\" );\n} catch ( FileSystemException e ) {\n  if ( e.getCause() instanceof AmazonServiceException ) {\n    String code = ((AmazonServiceException) e.getCause()).getErrorCode();\n    if ( !\"NoSuchKey\".equals( code ) ) { /* real connectivity/permission issue */ }\n  }\n}","preventionTips":["Verify bucket names against the target account before use","Keep credentials refreshed for long-running servers","Match region/endpoint to the bucket's actual region","Log AWS error codes, not just messages, when diagnosing"],"tags":["s3","vfs","attach","aws"],"backgroundTag":"resource-not-found","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"}