{"record":{"id":"0850df08df6e118b","repo":"apache/druid","slug":"runtimeexception-wrapping-underlying-cause","errorCode":null,"errorMessage":"RuntimeException wrapping underlying cause","messagePattern":"RuntimeException wrapping underlying cause","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/AzureDataSegmentPusher.java","lineNumber":114,"sourceCode":"  {\n    String prefix = segmentConfig.getPrefix();\n    boolean prefixIsNullOrEmpty = org.apache.commons.lang3.StringUtils.isEmpty(prefix);\n    final String azurePath = JOINER.join(\n        prefixIsNullOrEmpty ? null : StringUtils.maybeRemoveTrailingSlash(prefix),\n        storageDirSuffix\n    );\n\n    final int binaryVersion = SegmentUtils.getVersionFromDir(indexFilesDir);\n    File zipOutFile = null;\n\n    try {\n      final File outFile = zipOutFile = Files.createTempFile(\"index\", \".zip\").toFile();\n      final long size = CompressionUtils.zip(indexFilesDir, zipOutFile);\n\n      return uploadDataSegment(segment, binaryVersion, size, outFile, azurePath);\n    }\n    catch (Exception e) {\n      throw new RuntimeException(e);\n    }\n    finally {\n      if (zipOutFile != null) {\n        log.info(\"Deleting zipped index File[%s]\", zipOutFile);\n        zipOutFile.delete();\n      }\n    }\n  }\n\n  @Override\n  public Map<String, Object> makeLoadSpec(URI uri)\n  {\n    return makeLoadSpec(uri.toString());\n  }\n\n  @VisibleForTesting\n  String getAzurePath(final DataSegment segment, final boolean useUniquePath)\n  {","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/AzureDataSegmentPusher.java#L96-L132","documentation":"AzureDataSegmentPusher.pushToPath wraps any exception during segment zip creation or upload in a plain RuntimeException. This is a catch-all so callers of push() see a non-checked failure with the original cause attached, e.g. from CompressionUtils.zip or uploadDataSegment.","triggerScenarios":"pushToPath fails while creating the temp zip file, zipping the index directory (IOException from disk), or uploading via uploadDataSegment (Azure auth/network/size errors).","commonSituations":"Insufficient local temp disk space when zipping; Azure upload failures (throttling, oversized blob, bad credentials) during segment publishing.","solutions":["Read the wrapped cause via getCause() to find the zip or upload failure","Ensure enough free disk space in the temp directory for segment zips","Verify Azure credentials and that the segment size is within Azure blob limits","Retry the push; transient Azure errors are common during heavy ingestion"],"exampleFix":"// before\ncatch (Exception e) {\n  throw new RuntimeException(e);\n}\n// after\ncatch (Exception e) {\n  throw new RuntimeException(\"Failed to push segment \" + segment.getId() + \" to \" + azurePath, e);\n}","handlingStrategy":"try-catch","validationCode":"if (new File(System.getProperty(\"java.io.tmpdir\")).getUsableSpace() < minRequiredBytes) throw new IllegalStateException(\"Insufficient temp space for segment zip\");","typeGuard":null,"tryCatchPattern":"try { pusher.push(segmentFiles, segment); } catch (RuntimeException e) { log.error(\"Segment push failed: %s\", e.getCause(), e); throw e; }","preventionTips":["Monitor temp disk space on ingestion nodes","Validate Azure credentials and blob size limits before large segment pushes","Retry pushes on transient Azure errors with backoff","Include segment id/path in wrapped messages for debuggability"],"tags":["azure","segment-push","wrapping"],"backgroundTag":"file-write-failed","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"}