{"record":{"id":"0e5b78883c83fc8c","repo":"apache/druid","slug":"file-s-not-found","errorCode":null,"errorMessage":"File[%s] not found","messagePattern":"File\\[(.+?)\\] not found","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/frame/file/FrameFile.java","lineNumber":185,"sourceCode":"   *\n   * Package-private because this method is intended for use in tests. In production, {@code maxMmapSize} is\n   * set to {@link Integer#MAX_VALUE}.\n   *  @param file        ƒrame file\n   * @param maxMmapSize largest buffer to mmap at once\n   * @param byteTracker\n   * @param flags       optional flags\n   */\n  static FrameFile open(\n      final File file,\n      final int maxMmapSize,\n      @Nullable final ByteTracker byteTracker,\n      final Flag... flags\n  ) throws IOException\n  {\n    final EnumSet<Flag> flagSet = flags.length == 0 ? EnumSet.noneOf(Flag.class) : EnumSet.copyOf(Arrays.asList(flags));\n\n    if (!file.exists()) {\n      throw new FileNotFoundException(StringUtils.format(\"File[%s] not found\", file));\n    }\n\n    // Closer for mmap that is shared across all references: either footer only (if file size is larger\n    // Integer.MAX_VALUE) or entire file (if file size is smaller than, or equal to, Integer.MAX_VALUE).\n    Closeable sharedMapCloser = null;\n\n    try (final RandomAccessFile randomAccessFile = new RandomAccessFile(file, \"r\")) {\n      final long fileLength = randomAccessFile.length();\n\n      // Verify minimum file length.\n      if (fileLength <\n          FrameFileWriter.MAGIC.length + FrameFileWriter.TRAILER_LENGTH + Byte.BYTES /* MARKER_NO_MORE_FRAMES */) {\n        throw new IOE(\"File[%s] is too short (size[%,d])\", file, fileLength);\n      }\n\n      // Verify magic.\n      final byte[] buf = new byte[FrameFileWriter.TRAILER_LENGTH /* Larger than FrameFileWriter.MAGIC */];\n      final Memory bufMemory = Memory.wrap(buf, ByteOrder.LITTLE_ENDIAN);","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/frame/file/FrameFile.java#L167-L203","documentation":"FrameFile.open() memory-maps an existing frame file for reading. Before doing anything else it checks file.exists(); if the file is absent it throws FileNotFoundException naming the path. Frame files are typically written by durable storage or frame-writing stages and read later by frame-based query processing.","triggerScenarios":"Calling FrameFile.open(file, ...) with a path that does not exist on disk — e.g. frame file deleted between write and read, wrong directory in durable storage config, or a task re-reading frames after cleanup.","commonSituations":"Durable storage retention/cleanup removed the frame before the query finished reading it; configured storage directory differs across cluster nodes (shared storage misconfig); restart wiped a local temp frame directory.","solutions":["Check the file exists at the given path (ls) and re-run the query to regenerate it if it was transient.","Verify durable storage configuration (druid.storage / local temp dirs) is consistent across nodes.","Disable or extend cleanup/retention so frames outlive the queries using them.","Retry the query; if the failure persists, check shared storage health."],"exampleFix":"// before\nFrameFile.open(new File(\"/druid/frames/partial-0000.frame\"), Flag.REMOVE_FILE_ON_CLOSE); // ENOENT\n\n// after\nfinal File f = new File(\"/druid/frames/partial-0000.frame\");\nif (!f.exists()) {\n  throw new IllegalStateException(\"Frame missing; re-run stage: \" + f);\n}\nFrameFile.open(f, Flag.REMOVE_FILE_ON_CLOSE);","handlingStrategy":"validation","validationCode":"// Java: check existence before opening\nfinal File frameFile = new File(path);\nif (!frameFile.isFile()) {\n  throw new FileNotFoundException(\"Frame file missing (may have been cleaned up): \" + path);\n}","typeGuard":null,"tryCatchPattern":"try {\n  FrameFile.open(file, flags);\n} catch (FileNotFoundException e) {\n  // regenerate or retry the stage that produced the frame\n  throw new RetryableQueryException(\"Frame file gone: \" + file, e);\n}","preventionTips":["Keep durable-storage retention windows longer than the longest query duration.","Use identical storage paths/config on all nodes in shared-storage setups.","Avoid REMOVE_FILE_ON_CLOSE when frames may be re-read."],"tags":["file-not-found","frame-file","io","druid"],"backgroundTag":"file-not-found","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}