{"record":{"id":"145956debf1aed90","repo":"apache/druid","slug":"msqfault-from-worker-error-report","errorCode":null,"errorMessage":"MSQFault from worker error report","messagePattern":"MSQFault from worker error report","errorType":"error_code","errorClass":"MSQException","httpStatus":null,"severity":"error","filePath":"multi-stage-query/src/main/java/org/apache/druid/msq/exec/WorkerImpl.java","lineNumber":211,"sourceCode":"      // Report query metrics\n      reportQueryMetrics(maybeErrorReport.isEmpty(), stopwatch.millisElapsed());\n\n      if (maybeErrorReport.isPresent()) {\n        final MSQErrorReport errorReport = maybeErrorReport.get();\n        final String logMessage = MSQTasks.errorReportToLogMessage(errorReport, context.isDebug());\n        log.warn(\"%s\", logMessage);\n\n        // Inform controller of any errors that occur, unless we were canceled. This prevents attempting to contact\n        // the controller after cancellation due to controller failure. For situations where the worker is canceled\n        // but the controller is still alive, cancellation propagates to the controller in other ways. (For example,\n        // with single-shot tasks, the controller notices the task fails.)\n        if (!(errorReport.getFault() instanceof CanceledFault)) {\n          controllerClient.postWorkerError(errorReport);\n        }\n\n        if (t != null) {\n          Throwables.throwIfInstanceOf(t, MSQException.class);\n          throw new MSQException(t, maybeErrorReport.get().getFault());\n        } else {\n          throw new MSQException(maybeErrorReport.get().getFault());\n        }\n      }\n    }\n    catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n    finally {\n      runFuture.set(null);\n    }\n  }\n\n  @SuppressWarnings(\"unchecked\")\n  private void reportQueryMetrics(boolean success, long time)\n  {\n    long cpuTimeNs = 0L;\n    for (final CounterTracker tracker : stageCounters.values()) {","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/multi-stage-query/src/main/java/org/apache/druid/msq/exec/WorkerImpl.java#L193-L229","documentation":"WorkerImpl.run converts any worker failure into an MSQException carrying the fault from the MSQErrorReport. When the underlying throwable is not an MSQException (and not a cancellation), it is wrapped: 'MSQFault from worker error report' is the generic message whose real cause is the attached fault. The fault is also posted to the controller as a worker error beforehand.","triggerScenarios":"A worker task fails with a non-MSQException throwable (or with t==null after an error report was generated), so run() rethrows new MSQException(fault) using the error report's fault — surfacing the underlying fault details in the report, not this generic message.","commonSituations":"Worker-side engine failures (IO, serialization, channel errors) during stage execution; inspecting only the top-level message instead of the fault/cause in the error report shown by the SQL response or controller logs.","solutions":["Inspect the MSQFault details (errorCode/errorMessage) in the MSQErrorReport or the query's error output — the root cause is there, not in this wrapper message","Check worker (Peon/Task) logs for the full stack trace of the underlying throwable","Fix the underlying fault per its specific code (e.g. resource limits, bad input)","Retry the query after correcting the root cause"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { runWorker(); } catch (MSQException e) { MSQFault fault = e.getFault(); log.error(\"worker fault {}: {}\", fault.getErrorCode(), fault.getErrorMessage(), e.getCause()); }","preventionTips":["Always log fault.getErrorCode()/getErrorMessage(), not just getMessage()","Monitor worker task logs for root-cause stack traces","Keep stage resource limits within worker capacity"],"tags":["druid","msq","worker","wrapper-exception"],"backgroundTag":"internal-invariant-violation","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"}