{"record":{"id":"7a22a552fdc5fa76","repo":"conductor-oss/conductor","slug":"execution-not-found-executionid","errorCode":null,"errorMessage":"Execution not found: ${executionId}","messagePattern":"Execution not found: (.+?)","errorType":"http","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"agentspan/src/main/java/org/conductoross/conductor/ai/agentspan/runtime/service/AgentDagService.java","lineNumber":48,"sourceCode":"import com.netflix.conductor.common.metadata.workflow.WorkflowDef;\nimport com.netflix.conductor.common.metadata.workflow.WorkflowTask;\nimport com.netflix.conductor.core.exception.NotFoundException;\nimport com.netflix.conductor.dao.ExecutionDAO;\nimport com.netflix.conductor.model.TaskModel;\nimport com.netflix.conductor.model.WorkflowModel;\n\nimport lombok.RequiredArgsConstructor;\n\n@Service\n@RequiredArgsConstructor\npublic class AgentDagService {\n\n    private final ExecutionDAO executionDAO;\n\n    public InjectTaskResponse injectTask(String executionId, InjectTaskRequest req) {\n        WorkflowModel workflow = executionDAO.getWorkflow(executionId, true);\n        if (workflow == null) {\n            throw new NotFoundException(\"Execution not found: \" + executionId);\n        }\n\n        boolean isSubWorkflow =\n                \"SUB_WORKFLOW\".equals(req.getType()) && req.getSubWorkflowParam() != null;\n\n        // Build inputData — for SUB_WORKFLOW, include the standard Conductor fields\n        Map<String, Object> inputData;\n        if (isSubWorkflow) {\n            inputData = new LinkedHashMap<>();\n            inputData.put(\"subWorkflowName\", req.getSubWorkflowParam().getName());\n            inputData.put(\"subWorkflowVersion\", req.getSubWorkflowParam().getVersion());\n            // workflowInput is what was passed to the sub-workflow\n            inputData.put(\n                    \"workflowInput\", req.getInputData() != null ? req.getInputData() : Map.of());\n        } else {\n            inputData = req.getInputData() != null ? req.getInputData() : Collections.emptyMap();\n        }\n","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/agentspan/src/main/java/org/conductoross/conductor/ai/agentspan/runtime/service/AgentDagService.java#L30-L66","documentation":"Thrown by AgentDagService.injectTask when the execution referenced by executionId does not exist in the ExecutionDAO store. The service loads the workflow via executionDAO.getWorkflow(executionId, true) (includeTasks=true) and a null return means no workflow with that ID is persisted. NotFoundException maps to HTTP 404 at the REST layer. This is a runtime tracking-workflow operation for the agent DAG view.","triggerScenarios":"Calling injectTask with a stale, mistyped, or already-deleted execution ID; calling injectTask before the tracking workflow has been created via createTrackingWorkflow; using an execution ID from a different cluster/persistence store than the one the AgentDagService is wired to.","commonSituations":"Frontend DAG UI tries to inject a task into an execution whose record was pruned by pruneExecutions; SDK passes a parent execution ID that was never persisted because createTrackingWorkflow failed upstream; cross-environment ID leakage (e.g. staging ID used against production DAO).","solutions":["Verify the execution ID exists before calling injectTask by querying executionDAO.getWorkflow or the GET /api/agent/{id} endpoint.","Ensure createTrackingWorkflow was called and returned a non-null workflow ID before attempting to inject tasks into that ID.","Check that the AgentDagService and the caller share the same persistence backend (same ExecutionDAO bean / same DB).","If the ID comes from an external source, validate its format and existence before dispatching the inject call."],"exampleFix":"// before\nagentDagService.injectTask(unknownId, req);\n\n// after\nWorkflowModel wf = executionDAO.getWorkflow(unknownId, false);\nif (wf == null) {\n    return ResponseEntity.notFound().build();\n}\nagentDagService.injectTask(unknownId, req);","handlingStrategy":"validation","validationCode":"// Validate execution exists before injecting a task\nWorkflowModel wf = executionDAO.getWorkflow(executionId, false);\nif (wf == null) {\n    return ResponseEntity.status(HttpStatus.NOT_FOUND)\n        .body(\"Execution \" + executionId + \" does not exist\");\n}\nagentDagService.injectTask(executionId, req);","typeGuard":null,"tryCatchPattern":"try {\n    agentDagService.injectTask(executionId, req);\n} catch (NotFoundException e) {\n    // execution does not exist — return 404 to caller\n    return ResponseEntity.notFound().build();\n}","preventionTips":["Persist the execution ID returned by createTrackingWorkflow and reuse that exact value.","Validate the ID exists before any DAG mutation operation.","Ensure all services share the same ExecutionDAO backend."],"tags":["not-found","execution","agent-dag","validation"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}