{"record":{"id":"0b3a0e4b2b5b0c96","repo":"apache/iceberg","slug":"can-t-create-file-s","errorCode":null,"errorMessage":"Can't create file %s","messagePattern":"Can't create file (.+?)","errorType":"exception","errorClass":"RuntimeIOException","httpStatus":null,"severity":"error","filePath":"orc/src/main/java/org/apache/iceberg/orc/ORC.java","lineNumber":825,"sourceCode":"    } catch (IOException ioe) {\n      throw new RuntimeIOException(ioe, \"Failed to open file: %s\", file.location());\n    }\n  }\n\n  static Writer newFileWriter(\n      OutputFile file, OrcFile.WriterOptions options, Map<String, byte[]> metadata) {\n    if (file instanceof HadoopOutputFile) {\n      options.fileSystem(((HadoopOutputFile) file).getFileSystem());\n    } else {\n      options.fileSystem(new FileIOFSUtil.OutputFileSystem(file));\n    }\n    final Path locPath = new Path(file.location());\n    final Writer writer;\n\n    try {\n      writer = OrcFile.createWriter(locPath, options);\n    } catch (IOException ioe) {\n      throw new RuntimeIOException(ioe, \"Can't create file %s\", locPath);\n    }\n\n    metadata.forEach((key, value) -> writer.addUserMetadata(key, ByteBuffer.wrap(value)));\n\n    return writer;\n  }\n}\n","sourceCodeStart":807,"sourceCodeEnd":833,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/orc/src/main/java/org/apache/iceberg/orc/ORC.java#L807-L833","documentation":"ORC's newFileWriter creates the output file via OrcFile.createWriter. If an IOException occurs (unwritable directory, existing blob conflict, permissions, storage outage), it is rethrown as RuntimeIOException with 'Can't create file <path>'.","triggerScenarios":"Writing ORC data files when the target OutputFile cannot be created: bad output path/URI, insufficient permissions, storage quota/bucket issues, transient S3/HDFS errors.","commonSituations":"Misconfigured write.location or warehouse path; S3 bucket missing or credentials lacking PutObject; HDFS NameNode unreachable; disk full on local writes.","solutions":["Verify the output location/URI and that the parent directory/bucket exists and is writable","Check storage credentials and permissions for writes","Retry the write if the underlying storage error was transient","Validate FileIO configuration (fs defaults, region, endpoint)"],"exampleFix":"// before\nString loc = \"hdfs://old-nn/warehouse/table/data/file.orc\"; // stale NameNode\n// after\nString loc = table.locationProvider().newDataLocation(spec, partition, filename); // derive from table config","handlingStrategy":"try-catch","validationCode":"OutputFile out = io.newOutputFile(target);\n// verify location writable with a small probe where supported, e.g.\nif (!target.startsWith(table.location())) throw new IllegalArgumentException(\"Write outside table location\");","typeGuard":null,"tryCatchPattern":"try {\n  return OrcFileAppenderFactory.create(out, options, metadata);\n} catch (RuntimeIOException e) {\n  if (e.getMessage().startsWith(\"Can't create file\")) {\n    log.error(\"Cannot create ORC output {}: {}\", out.location(), e.getCause());\n    throw e;\n  } throw e;\n}","preventionTips":["Verify warehouse/write location config and bucket existence before writes","Check write credentials (S3 PutObject, HDFS permissions)","Monitor storage quota and disk space","Derive output paths from the table's LocationProvider rather than hardcoding"],"tags":["orc","io","file-write","filesystem"],"backgroundTag":"file-write-failed","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}