{"record":{"id":"0147f1eae8322be5","repo":"apache/dolphinscheduler","slug":"the-taskexecutor-id-taskinstanceid-is-not-exist","errorCode":null,"errorMessage":"The TaskExecutor id ${taskInstanceId} is not exist.","messagePattern":"The TaskExecutor id (.+?) is not exist\\.","errorType":"exception","errorClass":"BaseException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-executor/src/main/java/org/apache/dolphinscheduler/task/executor/eventbus/TaskExecutorLifecycleEventRemoteReporter.java","lineNumber":206,"sourceCode":"            log.warn(\"TaskExecutor is not exists: {}\", taskExecutorId);\n        }\n    }\n\n    private void handleTaskExecutionEventChannel(final ReportableTaskExecutorLifecycleEventChannel reportableTaskExecutorLifecycleEventChannel) {\n        if (reportableTaskExecutorLifecycleEventChannel.isEmpty()) {\n            return;\n        }\n        while (!reportableTaskExecutorLifecycleEventChannel.isEmpty()) {\n            final IReportableTaskExecutorLifecycleEvent headEvent = reportableTaskExecutorLifecycleEventChannel.peek();\n            try (\n                    final TaskExecutorMDCUtils.MDCAutoClosable ignore =\n                            TaskExecutorMDCUtils.logWithMDC(headEvent.getTaskInstanceId())) {\n                try {\n                    if (isTaskExecutorEventNeverSent(headEvent) || isRetryIntervalExceeded(headEvent)) {\n                        final Optional<ITaskExecutor> taskExecutorOptional =\n                                taskExecutorRepository.get(headEvent.getTaskInstanceId());\n                        if (!taskExecutorOptional.isPresent()) {\n                            throw new BaseException(String.format(\"The TaskExecutor id %d is not exist.\",\n                                    headEvent.getTaskInstanceId()));\n                        }\n                        final String masterAddress =\n                                taskExecutorOptional.get().getTaskExecutionContext().getWorkflowInstanceHost();\n                        taskExecutorEventRemoteReporterClient.reportTaskExecutionEventToMaster(masterAddress,\n                                headEvent);\n                        continue;\n                    }\n                    if (log.isDebugEnabled()) {\n                        log.debug(\n                                \"The ReportableTaskExecutorLifecycleEvent: {} latest send time: {} doesn't exceeded retry interval\",\n                                headEvent,\n                                headEvent.getLatestReportTime());\n                    }\n                    break;\n                } catch (Exception ex) {\n                    log.error(\"Send TaskExecutionEvent: {} to master error will retry after {} mills\",\n                            headEvent,","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-executor/src/main/java/org/apache/dolphinscheduler/task/executor/eventbus/TaskExecutorLifecycleEventRemoteReporter.java#L188-L224","documentation":"The lifecycle event reporter's channel runner (run -> handleTaskExecutionEventChannel) looks up the ITaskExecutor for a pending event's taskInstanceId before reporting it to the master. If the event is still pending/retrying but the executor is no longer in the repository, it throws BaseException \"The TaskExecutor id %d is not exist.\" — the event has no owner to report for.","triggerScenarios":"A task execution event was queued (or is being retried after failures) and, before it is successfully reported, the corresponding task executor was removed from taskExecutorRepository (task finished/killed/cleaned up), so repository.get(taskInstanceId) returns empty.","commonSituations":"Master restart or task cleanup racing with a backlog of unreported events; events retained past the task's lifecycle; memory pressure evicting executors while retrying failed reports.","solutions":["Verify events are drained/reported before removing executors from the repository","Investigate why reporting failed repeatedly until the executor was removed (network to master, master down)","Reduce event backlog by ensuring the master address is reachable and the reporter client healthy","On occurrence, treat the stale event as droppable or purge orphaned events after executor removal"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (taskExecutorRepository.get(event.getTaskInstanceId()).isEmpty()) {\n    // event is stale: drop or move to dead-letter instead of reporting\n    return;\n}","typeGuard":null,"tryCatchPattern":"try {\n    reporterChannel.run();\n} catch (BaseException e) {\n    if (e.getMessage().contains(\"is not exist\")) {\n        log.warn(\"Dropping stale lifecycle event; executor removed\");\n    } else throw e;\n}","preventionTips":["Remove an executor from the repository only after its event queue is drained","Keep the master reachable so events don't retry past executor lifetime","Purge/expire orphaned events when executors are cleaned up"],"tags":["task-executor","eventbus","race-condition","lifecycle"],"backgroundTag":"entity-not-found","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}