{"record":{"id":"915a7dcefe2fbce4","repo":"apache/druid","slug":"unable-to-read-the-task-id-from-the-file-s","errorCode":null,"errorMessage":"Unable to read the task id from the file: [%s]","messagePattern":"Unable to read the task id from the file: \\[(.+?)\\]","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"multi-stage-query/src/main/java/org/apache/druid/msq/shuffle/input/DurableStorageInputChannelFactory.java","lineNumber":187,"sourceCode":"    String successfulFilePath = getWorkerOutputSuccessFilePath(controllerTaskId, stageNumber, workerNo);\n\n    if (!storageConnector.pathExists(successfulFilePath)) {\n      throw new ISE(\n          \"No file present at the location [%s]. Unable to read the outputs of stage [%d], partition [%d] for the worker [%d]\",\n          successfulFilePath,\n          stageNumber,\n          partitionNumber,\n          workerNo\n      );\n    }\n\n    String successfulTaskId;\n\n    try (InputStream is = storageConnector.read(successfulFilePath)) {\n      successfulTaskId = IOUtils.toString(is, StandardCharsets.UTF_8);\n    }\n    if (successfulTaskId == null) {\n      throw new ISE(\"Unable to read the task id from the file: [%s]\", successfulFilePath);\n    }\n    LOG.debug(\n        \"Reading output of stage [%d], partition [%d] from task id [%s]\",\n        stageNumber,\n        partitionNumber,\n        successfulTaskId\n    );\n\n    return getPartitionOutputsFileNameWithPathForPartition(\n        controllerTaskId,\n        stageNumber,\n        workerNo,\n        partitionNumber,\n        successfulTaskId\n    );\n  }\n\n  /**","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/multi-stage-query/src/main/java/org/apache/druid/msq/shuffle/input/DurableStorageInputChannelFactory.java#L169-L205","documentation":"After confirming the success file exists, findSuccessfulPartitionOutput reads its contents as the producing task id. If IOUtils.toString returns null, this ISE is thrown because a null task id makes it impossible to locate the partition output. In practice this happens only if the underlying stream yields null content (unusual; usually an empty file yields an empty string instead).","triggerScenarios":"Reading the '_success' file via storageConnector.read and getting a null string back: truncated/corrupt success file, a storage connector implementation that returns null for empty objects, or a race where the file content is not yet visible.","commonSituations":"Corrupt or empty success marker in deep storage caused by a producer crash during write; unusual custom storage connector implementations (extensions) that return null streams/data for empty files.","solutions":["Inspect the success file contents in deep storage; if empty/corrupt, rerun the query to regenerate it.","Check your storage connector extension implementation to ensure it never returns null for existing objects.","Check producer task logs for a crash between creating and writing the success file."],"exampleFix":"// before: only null check\nsuccessfulTaskId = IOUtils.toString(is, StandardCharsets.UTF_8);\nif (successfulTaskId == null) { throw new ISE(...); }\n\n// after: also reject empty ids\nsuccessfulTaskId = IOUtils.toString(is, StandardCharsets.UTF_8);\nif (successfulTaskId == null || successfulTaskId.trim().isEmpty()) {\n  throw new ISE(\"Success file [%s] has empty task id\", successfulFilePath);\n}","handlingStrategy":"validation","validationCode":"// before relying on the marker content\nString taskId = readSuccessFile(path);\nif (taskId == null || taskId.trim().isEmpty()) {\n  throw new IllegalStateException(\"Corrupt success marker at \" + path + \" — rerun query\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  resolveProducerTask();\n} catch (IllegalStateException e) {\n  if (e.getMessage().startsWith(\"Unable to read the task id\")) { rerunQuery(); }\n  else { throw e; }\n}","preventionTips":["Keep storage connector extensions updated so empty objects never read back as null.","Alert on producer tasks crashing between writing output and the success marker.","Rerun queries whose success markers are empty rather than retrying reads."],"tags":["deep-storage","msq","corrupt-file","task-id"],"backgroundTag":"empty-required-field","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}