{"record":{"id":"87e7decb0b7fb0c5","repo":"prestodb/presto","slug":"iceberg-filesystem-error-87e7de","errorCode":"ICEBERG_FILESYSTEM_ERROR","errorMessage":"Failed to create input file: ${path}","messagePattern":"Failed to create input file: (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-iceberg/src/main/java/com/facebook/presto/iceberg/HdfsInputFile.java","lineNumber":54,"sourceCode":"    private final String user;\n    private final AtomicLong length;\n\n    public HdfsInputFile(Path path, HdfsEnvironment environment, HdfsContext context, Optional<Long> length)\n    {\n        requireNonNull(path, \"path is null\");\n        this.environment = requireNonNull(environment, \"environment is null\");\n        this.length = new AtomicLong(length.orElse(-1L));\n        requireNonNull(context, \"context is null\");\n        try {\n            if (this.length.get() < 0) {\n                this.delegate = HadoopInputFile.fromPath(path, environment.getFileSystem(context, path), environment.getConfiguration(context, path));\n            }\n            else {\n                this.delegate = HadoopInputFile.fromPath(path, this.length.get(), environment.getFileSystem(context, path), environment.getConfiguration(context, path));\n            }\n        }\n        catch (IOException e) {\n            throw new PrestoException(ICEBERG_FILESYSTEM_ERROR, \"Failed to create input file: \" + path, e);\n        }\n        this.user = context.getIdentity().getUser();\n    }\n\n    public HdfsInputFile(Path path, HdfsEnvironment environment, HdfsContext context)\n    {\n        this(path, environment, context, Optional.empty());\n    }\n\n    @Override\n    public long getLength()\n    {\n        return length.updateAndGet(value -> {\n            if (value < 0) {\n                return environment.doAs(user, delegate::getLength);\n            }\n            return value;\n        });","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-iceberg/src/main/java/com/facebook/presto/iceberg/HdfsInputFile.java#L36-L72","documentation":"HdfsInputFile's constructor creates a HadoopInputFile delegate for the given path using the filesystem and configuration from HdfsEnvironment. Any IOException during this creation is converted to a PrestoException with code ICEBERG_FILESYSTEM_ERROR, so failures opening/accessing the file (missing file, bad credentials, wrong scheme) surface here at construction time.","triggerScenarios":"Constructing HdfsInputFile for a path whose HadoopInputFile.fromPath throws IOException: path does not exist, permission denied, unsupported/incorrect URI scheme, or filesystem initialization failure (bad Namenode address, missing credentials).","commonSituations":"Reading a table whose metadata/data files were deleted externally, misconfigured s3/hdfs URI, expired cloud credentials, missing jar for the filesystem scheme, permission/impersonation mismatch.","solutions":["Verify the path exists and is readable by the Presto user (hdfs dfs -test / aws s3 ls).","Fix the URI scheme and filesystem configuration (core-site/hive metastore thrift URI, s3 credentials).","Check the wrapped IOException cause for permission vs not-found vs connectivity and address accordingly.","Confirm the filesystem plugin/jar for the scheme (s3a, abfs, gcs) is installed on the coordinator/workers."],"exampleFix":"// before\nInputFile in = new HdfsInputFile(new Path(path), environment, context);\n// after: pre-check\nPath p = new Path(path);\nFileSystem fs = environment.getFileSystem(context, p);\nif (!fs.exists(p)) { throw new TableNotFoundException(...); }\nInputFile in = new HdfsInputFile(p, environment, context);","handlingStrategy":"validation","validationCode":"Path p = new Path(path);\nFileSystem fs = environment.getFileSystem(context, p);\nif (!fs.exists(p)) throw new TableNotFoundException(schemaTableName);\nfs.open(p).close(); // probe readability","typeGuard":"boolean canOpen(HdfsContext ctx, String path) { try { return environment.getFileSystem(ctx, new Path(path)).exists(new Path(path)); } catch (IOException e) { return false; } }","tryCatchPattern":"try { InputFile f = new HdfsInputFile(path, env, ctx); } catch (PrestoException e) { if (e.getCause() instanceof FileNotFoundException) { /* file vanished: reload metadata */ } else if (e.getCause() instanceof IOException) { /* perms/connectivity: alert */ } throw e; }","preventionTips":["Keep files longer than the longest query (snapshot expiration/orphan cleanup retention)","Verify filesystem scheme plugins (s3a/abfs/gcs) are installed cluster-wide","Test credentials/impersonation for each filesystem scheme after config changes","Point tables at stable, existing locations before queries"],"tags":["filesystem","hdfs","input-file","permissions"],"backgroundTag":"filesystem-open-failed","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}