{"record":{"id":"0cfe527d90a4c506","repo":"apache/druid","slug":"controller-s","errorCode":null,"errorMessage":"Controller: %s","messagePattern":"Controller: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"multi-stage-query/src/main/java/org/apache/druid/msq/exec/ControllerImpl.java","lineNumber":516,"sourceCode":"\n      taskStateForReport = TaskState.FAILED;\n\n      if (cancelReason == CancellationReason.UNKNOWN && cancelException != null) {\n        // Cancellation triggered by an external error. Report the original error.\n        if (exceptionEncountered != null) {\n          cancelException.addSuppressed(exceptionEncountered);\n        }\n        errorForReport =\n            MSQErrorReport.fromException(queryId(), selfHost, null, cancelException, querySpec.getColumnMappings());\n      } else if (cancelReason != null) {\n        errorForReport = MSQErrorReport.fromFault(queryId(), selfHost, null, new CanceledFault(cancelReason));\n      } else {\n        errorForReport = MSQTasks.makeErrorReport(queryId(), selfHost, controllerError, workerError);\n      }\n\n      // Log the errors we encountered.\n      if (controllerError != null) {\n        log.warn(\"Controller: %s\", MSQTasks.errorReportToLogMessage(controllerError, context.isDebug()));\n      }\n\n      if (workerError != null) {\n        log.warn(\"Worker: %s\", MSQTasks.errorReportToLogMessage(workerError, context.isDebug()));\n      }\n    }\n    if (queryKernel != null && queryKernel.isSuccess()) {\n      // If successful, encourage workers to exit successfully.\n      // Only send this command to participating workers. For task-based queries, this is all tasks, since tasks\n      // are launched only when needed. For Dart, this is any servers that were actually assigned work items.\n      postFinishToWorkers(queryKernel.getAllParticipatingWorkers());\n      workerManager.stop(false);\n    } else {\n      // If not successful, cancel running tasks.\n      if (workerManager != null) {\n        workerManager.stop(true);\n      }\n    }","sourceCodeStart":498,"sourceCodeEnd":534,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/multi-stage-query/src/main/java/org/apache/druid/msq/exec/ControllerImpl.java#L498-L534","documentation":"In ControllerImpl.runInternal (MSQ engine), when a query finishes with an error, the controller error report is logged as 'Controller: %s' before the error is reported to the caller. This log line is the controller-side diagnostic for why the MSQ query failed; the actual failure detail is in the rendered error report message.","triggerScenarios":"Any MSQ (SQL INSERT/REPLACE/DART) query fails during controller execution: planning faults, worker faults, task failures, or user errors (e.g. bad context values) surface through this controller error logging path.","commonSituations":"Users see 'Controller:' followed by a report like 'Query did not have proper context' or 'Fault class ...' in the Overlord/controller logs after a failed MSQ query in the Druid console or via JDBC.","solutions":["Read the full rendered message after 'Controller:' — it names the MSQ fault class and root cause; fix the reported underlying issue.","If the cause is a worker fault, also check the paired 'Worker:' log line and the specific task's logs.","Enable query context 'debug':true to get fuller stack traces in the error report."],"exampleFix":"// before (client)\nINSERT INTO dst SELECT ... WITH context {\"debug\": false}\n// after\nINSERT INTO dst SELECT ... WITH context {\"debug\": true} // richer Controller/Worker diagnostics","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  runMsqQuery(query);\n} catch (MSQException e) {\n  // read fault class + message rendered after \"Controller:\" in controller logs\n  handleMsqFault(e.getFaultClass(), e.getMessage());\n}","preventionTips":["Set context {\"debug\":true} when diagnosing MSQ failures for fuller reports.","Read the fault class name in the Controller log line; it maps directly to remediation docs.","Keep controller (Overlord) logs alongside task logs to correlate failures."],"tags":["druid","msq","controller","query-failure","logging"],"backgroundTag":"msq-query-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"}