{"record":{"id":"8fce8ac2b6a522e4","repo":"kestra-io/kestra","slug":"namespace-and-flowid-should-only-be-set-when","errorCode":null,"errorMessage":"`namespace` and `flowId` should only be set when `executionId` is set.","messagePattern":"`namespace` and `flowId` should only 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":176,"sourceCode":"        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    /**\n     * @param render whether to render file contents using Pebble expressions.\n     */\n    private static void createInputFilesInternal(RunContext runContext, Path workingDirectory, Map<String, String> inputFiles, Map<String, Object> additionalVars, boolean render)\n        throws Exception {\n        if (inputFiles != null && !inputFiles.isEmpty()) {\n            for (String fileName : inputFiles.keySet()) {\n                String finalFileName = runContext.render(fileName);\n","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/models/tasks/runners/PluginUtilsService.java#L158-L194","documentation":"Thrown by PluginUtilsService when executionId is null BUT namespace or flowId is set. The namespace/flowId fields are ONLY meaningful as companions to an explicit executionId; without executionId the task always operates on the current execution (sourced from flowInfo), so setting namespace/flowId is contradictory and rejected. Mirrors error 33 — together they enforce the all-or-nothing pairing of namespace/flowId with executionId.","triggerScenarios":"A task sets namespace/flowId but omits executionId; operator assumes namespace/flowId select a target flow without an execution reference.","commonSituations":"Misunderstanding that namespace/flowId are subordinate to executionId; leftover config from a different task shape.","solutions":["If you meant to target a specific execution, also set executionId.","If operating on the current execution, remove namespace and flowId entirely.","Re-read the task property docs to confirm the required combinations."],"exampleFix":"# before\ntask:\n  namespace: \"team.prod\"\n  flowId: \"myflow\"\n  # executionId missing\n\n# after (target current execution): remove namespace/flowId\ntask: {}\n# OR (target specific execution): add executionId\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(\"`namespace` and `flowId` should only 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;\n  return (!o.namespace && !o.flowId) || (!!o.namespace && !!o.flowId);\n}","tryCatchPattern":"try {\n    PluginUtilsService.executionInfo(runContext, executionId, namespace, flowId);\n} catch (IllegalArgumentException e) {\n    log.error(\"namespace/flowId set without executionId: {}\", e.getMessage());\n}","preventionTips":["Omit namespace and flowId when targeting the current execution.","Document the all-or-nothing rule for execution references."],"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"}