kestra-io/kestra · error · IllegalArgumentException

Trigger variable is missing 'executionId' key, notification

Error message

Trigger variable is missing 'executionId' key, notification plugins can only be used either on the current execution or an execution triggered by a Flow trigger.

What it means

Error "Trigger variable is missing 'executionId' key, notification plugins can only be used either on the current execution or an execution triggered by a Flow trigger." thrown in kestra-io/kestra.

Source

Thrown at core/src/main/java/io/kestra/core/plugins/notifications/ExecutionService.java:57

            .ifPresent(s -> templateRenderMap.put("customMessage", s));

        final Map<String, Object> renderedCustomFields = runContext.render(executionInterface.getCustomFields()).asMap(String.class, Object.class);
        if (!renderedCustomFields.isEmpty()) {
            templateRenderMap.put("customFields", renderedCustomFields);
        }

        templateRenderMap.put("firstFailed", executionContext.firstFailed() != null ? executionContext.firstFailed() : false);
        templateRenderMap.put("lastTask", executionContext.lastTask());

        return templateRenderMap;
    }

    @SuppressWarnings("unchecked")
    private static ExecutionContext contextFromTriggerExecution(RunContext runContext) {
        Map<String, Object> executionMap = (Map<String, Object>) runContext.getVariables().get("execution");
        Map<String, Object> triggerVar = (Map<String, Object>) runContext.getVariables().get("trigger");
        if (triggerVar == null || !triggerVar.containsKey("executionId")) {
            throw new IllegalArgumentException(
                "Trigger variable is missing 'executionId' key, notification plugins can only be used either on the current execution or an execution triggered by a Flow trigger."
            );
        }

        return new ExecutionContext(
            (String) executionMap.get("tenantId"),
            (String) triggerVar.get("namespace"),
            (String) triggerVar.get("flowId"),
            (String) triggerVar.get("executionId"),
            new ExecutionContextState(
                (String) triggerVar.get("state"),
                (String) triggerVar.get("startDate"),
                (String) triggerVar.get("endDate")
            ),
            triggerVar.containsKey("firstFailedTaskId") ? new ExecutionContextTask((String) triggerVar.get("firstFailedTaskId")) : null,
            triggerVar.containsKey("lastTaskId") ? new ExecutionContextTask((String) triggerVar.get("lastTaskId")) : null
        );
    }

View on GitHub (pinned to 823fada927)

Solutions

  1. Use the notification plugin within a flow execution context, or on an execution started by a Flow trigger, so 'executionId' is present in the trigger variables.
  2. If you must notify outside an execution, pass an explicit executionId to the notification task.

When it happens

Trigger: Thrown at core/src/main/java/io/kestra/core/plugins/notifications/ExecutionService.java:57 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kestra-io/kestra@823fada927 (2026-08-14). Data as JSON: /api/errors/2c37d6add8b2b6c8. Report an issue: GitHub.