{"record":{"id":"83e5901821bea6bf","repo":"apache/iceberg","slug":"failed-to-get-status-for-file-s","errorCode":null,"errorMessage":"Failed to get status for file: %s","messagePattern":"Failed to get status for file: (.+?)","errorType":"exception","errorClass":"RuntimeIOException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/hadoop/HadoopInputFile.java","lineNumber":168,"sourceCode":"  }\n\n  private HadoopInputFile(FileSystem fs, FileStatus stat, Configuration conf) {\n    this.fs = fs;\n    this.path = stat.getPath();\n    this.location = path.toString();\n    this.stat = stat;\n    this.conf = conf;\n    this.length = stat.getLen();\n  }\n\n  private FileStatus lazyStat() {\n    if (stat == null) {\n      try {\n        this.stat = fs.getFileStatus(path);\n      } catch (FileNotFoundException e) {\n        throw new NotFoundException(e, \"File does not exist: %s\", path);\n      } catch (IOException e) {\n        throw new RuntimeIOException(e, \"Failed to get status for file: %s\", path);\n      }\n    }\n    return stat;\n  }\n\n  @Override\n  public long getLength() {\n    if (length == null) {\n      this.length = lazyStat().getLen();\n    }\n    return length;\n  }\n\n  @Override\n  public SeekableInputStream newStream() {\n    try {\n      return HadoopStreams.wrap(fs.open(path));\n    } catch (FileNotFoundException e) {","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/hadoop/HadoopInputFile.java#L150-L186","documentation":"The non-FileNotFound branch of lazyStat(): any other IOException while fetching the FileStatus is wrapped in this RuntimeIOException. It signals the filesystem was reachable but status retrieval failed (network, permissions, throttling, corruption) rather than the file being absent.","triggerScenarios":"getLength/getStat/exists on a HadoopInputFile when fs.getFileStatus throws IOException other than FileNotFoundException — HDFS datanode failures, S3 503/throttling responses, Kerberos token expiry, permission denied.","commonSituations":"Expired Kerberos tokens in long-running jobs; S3 request-rate throttling during large scans; intermittent HDFS connectivity; bucket permissions changed mid-job.","solutions":["Inspect the cause exception for the concrete FS error (permissions, throttling, token expiry).","Retry with backoff for transient errors (throttling, network blips).","Refresh credentials/tokens if the job runs longer than the token lifetime.","Verify FS permissions and bucket policies allow HEAD/GET on the object.","Reduce parallelism if the object store is rate-limiting requests."],"exampleFix":"// before\nlong len = io.newInputFile(path).getLength();\n// after\ntry {\n  long len = io.newInputFile(path).getLength();\n} catch (RuntimeIOException e) {\n  if (e.getCause() instanceof FileNotFoundException) { /* missing file path */ }\n  else { /* transient FS error: retry with backoff */ }\n}","handlingStrategy":"retry","validationCode":"InputFile f = io.newInputFile(path);\nif (!f.exists()) return; // distinguish missing (NotFoundException) from transient IO","typeGuard":null,"tryCatchPattern":"try {\n  long len = io.newInputFile(path).getLength();\n} catch (RuntimeIOException e) {\n  if (e.getCause() instanceof FileNotFoundException) throw e; // permanent\n  // otherwise retry with backoff\n}","preventionTips":["Use Tasks.foreach/retry with exponential backoff for FS reads in jobs.","Renew Kerberos/cloud credentials before they expire in long jobs.","Watch for object-store throttling and cap reader parallelism."],"tags":["io","filesystem","transient","hadoop"],"backgroundTag":"file-read-failed","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}