{"record":{"id":"79e9b2af97806ef9","repo":"kestra-io/kestra","slug":"both-namespace-and-flowid-must-be-set-when-ex","errorCode":null,"errorMessage":"Both `namespace` and `flowId` must be set when `executionId` is set.","messagePattern":"Both `namespace` and `flowId` must be set when `executionId` is set\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/models/tasks/runners/PluginUtilsService.java","lineNumber":168,"sourceCode":"     */\n    @SuppressWarnings(\"unchecked\")\n    public static ExecutionInfo executionFromTaskParameters(RunContext runContext, String namespace, String flowId, String executionId) throws IllegalVariableEvaluationException {\n        var flowInfo = runContext.flowInfo();\n\n        String realTenantId = flowInfo.tenantId();\n        String realExecutionId;\n        String realNamespace;\n        String realFlowId;\n        if (executionId != null) {\n            realExecutionId = runContext.render(executionId);\n\n            if (namespace != null && flowId != null) {\n                realNamespace = runContext.render(namespace);\n                realFlowId = runContext.render(flowId);\n                // validate that the flow exists: a.k.a access is authorized by this namespace\n                runContext.acl().allowNamespace(realNamespace).check();\n            } else if (namespace != null || flowId != null) {\n                throw new IllegalArgumentException(\"Both `namespace` and `flowId` must be set when `executionId` is set.\");\n            } else {\n                realNamespace = flowInfo.namespace();\n                realFlowId = flowInfo.id();\n            }\n\n        } else {\n            if (namespace != null || flowId != null) {\n                throw new IllegalArgumentException(\"`namespace` and `flowId` should only be set when `executionId` is set.\");\n            }\n            realExecutionId = (String) new HashMap<>((Map<String, Object>) runContext.getVariables().get(\"execution\")).get(\"id\");\n            realNamespace = flowInfo.namespace();\n            realFlowId = flowInfo.id();\n        }\n\n        return new ExecutionInfo(realTenantId, realNamespace, realFlowId, realExecutionId);\n    }\n\n    /**","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/models/tasks/runners/PluginUtilsService.java#L150-L186","documentation":"Thrown by PluginUtilsService when executionId is set (non-null) but exactly one of namespace/flowId is set while the other is null. The contract is: when executionId is provided, namespace and flowId must BOTH be provided (to explicitly target a specific execution), or BOTH omitted (defaults to the current execution's namespace/flowId). Setting only one is ambiguous and rejected as an IllegalArgumentException.","triggerScenarios":"A task sets executionId and namespace but forgets flowId; executionId and flowId are set but namespace is null; partial rendering leaves one field resolved and the other blank.","commonSituations":"Operator references a subflow execution but provides an incomplete identifier; a Pebble variable for namespace or flowId renders to empty/null; copy-paste of a partial config.","solutions":["When executionId is set, provide BOTH namespace and flowId, or neither.","Verify both Pebble expressions resolve to non-null strings.","If targeting the current execution, omit namespace and flowId entirely."],"exampleFix":"# before\ntask:\n  executionId: \"{{ executionId }}\"\n  namespace: \"team.prod\"\n  # flowId missing\n\n# after\ntask:\n  executionId: \"{{ executionId }}\"\n  namespace: \"team.prod\"\n  flowId: \"myflow\"","handlingStrategy":"validation","validationCode":"if (executionId != null && (namespace == null) != (flowId == null)) {\n    throw new IllegalArgumentException(\"Both `namespace` and `flowId` must be set when `executionId` is set.\");\n}","typeGuard":"function isExecutionRefValid(o: { executionId?: string; namespace?: string; flowId?: string }): boolean {\n  if (o.executionId) return (!o.namespace && !o.flowId) || (!!o.namespace && !!o.flowId);\n  return !o.namespace && !o.flowId;\n}","tryCatchPattern":"try {\n    PluginUtilsService.executionInfo(runContext, executionId, namespace, flowId);\n} catch (IllegalArgumentException e) {\n    log.error(\"Invalid execution reference: {}\", e.getMessage());\n}","preventionTips":["Provide namespace and flowId together, or not at all, when executionId is set.","Assert both Pebble expressions resolve to non-null before submission."],"tags":["task-runner","validation","execution","namespace","flow"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}