{"record":{"id":"fd42e238bb745eb4","repo":"apache/druid","slug":"could-not-delete-cache-file-at-s","errorCode":null,"errorMessage":"Could not delete cache file at [%s]","messagePattern":"Could not delete cache file at \\[(.+?)\\]","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"extensions-contrib/cassandra-storage/src/main/java/org/apache/druid/storage/cassandra/CassandraDataSegmentPuller.java","lineNumber":104,"sourceCode":"      log.info(\n          \"Pull of file[%s] completed in %,d millis (%s bytes)\", key, System.currentTimeMillis() - startTime,\n          result.size()\n      );\n      return result;\n    }\n    catch (Exception e) {\n      try {\n        FileUtils.deleteDirectory(outDir);\n      }\n      catch (IOException e1) {\n        log.error(e1, \"Error clearing segment directory [%s]\", outDir.getAbsolutePath());\n        e.addSuppressed(e1);\n      }\n      throw new SegmentLoadingException(e, e.getMessage());\n    }\n    finally {\n      if (!tmpFile.delete()) {\n        log.warn(\"Could not delete cache file at [%s]\", tmpFile.getAbsolutePath());\n      }\n    }\n  }\n}\n","sourceCodeStart":86,"sourceCodeEnd":109,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-contrib/cassandra-storage/src/main/java/org/apache/druid/storage/cassandra/CassandraDataSegmentPuller.java#L86-L109","documentation":"CassandraDataSegmentPuller.getSegmentFiles() writes the downloaded segment to a temp file and extracts it; in the finally block it attempts tmpFile.delete() and logs this warning if deletion returns false, leaving the cached temp file on disk. The primary error (SegmentLoadingException) is unaffected — this is only a cleanup warning.","triggerScenarios":"Any failure path through getSegmentFiles (Cassandra I/O error, corrupt segment zip) where File.delete() on the temp file fails — typically because the file is still open/locked by an unclosed stream, or permissions prevent deletion.","commonSituations":"Cassandra storage misconfiguration or outage triggering the failure path; OS (Windows) holding the file lock; cache directory owned by another user; disk full earlier in the flow.","solutions":["Locate and delete the leftover tmp file in the segment cache directory","Check that all streams to tmpFile are closed before delete (upgrade Druid if an older version leaks the stream)","Verify filesystem permissions for the Druid process on the cache dir","Fix the underlying Cassandra pull error that put the code on the failure path"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  puller.getSegmentFiles(descriptor);\n} catch (SegmentLoadingException e) {\n  log.warn(e, \"Cassandra segment pull failed; check for leftover tmp cache files\");\n}","preventionTips":["Ensure Cassandra connectivity and schema (segment table) are correct","Grant the Druid process write+delete permissions on the cache dir","On Windows, beware file locks preventing tmpFile.delete(); prefer Linux hosts","Periodically sweep stale tmp files from the segment cache location"],"tags":["cassandra","segment-loading","filesystem-cleanup","temp-file"],"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-17T15:17:12.973Z"}