{"record":{"id":"ac6e203cfb820f14","repo":"conductor-oss/conductor","slug":"no-agent-execution-found-executionid","errorCode":null,"errorMessage":"No agent execution found: ${executionId}","messagePattern":"No agent execution found: (.+?)","errorType":"http","errorClass":"NotFoundException","httpStatus":404,"severity":"warning","filePath":"agentspan/src/main/java/org/conductoross/conductor/ai/agentspan/runtime/service/AgentService.java","lineNumber":685,"sourceCode":"                // After deletion, restart from 0 since the result set shifts\n            }\n        }\n        return deleted;\n    }\n\n    /**\n     * Gracefully stop an agent execution by setting the _stop_requested flag.\n     *\n     * <p>The loop exits after the current iteration completes and the workflow reaches COMPLETED\n     * status with the last LLM output as the result. Also sends a WMQ message to unblock agents\n     * waiting on PULL_WORKFLOW_MESSAGES.\n     */\n    public void stopAgent(String executionId) {\n        // Set the stop flag — the DoWhile loop condition checks this variable.\n        // Get the workflow model, update its variables map, and persist.\n        WorkflowModel workflow = executionDAO.getWorkflow(executionId, false);\n        if (workflow == null) {\n            throw new NotFoundException(\"No agent execution found: \" + executionId);\n        }\n        workflow.getVariables().put(\"_stop_requested\", true);\n        executionDAO.updateWorkflow(workflow);\n        // Note: the SDK also sends a WMQ unblock message via the Conductor client\n        // to wake agents blocked on PULL_WORKFLOW_MESSAGES.\n    }\n\n    /**\n     * Inject a persistent signal into a running agent's context.\n     *\n     * <p>Sets the {@code _signal_injection} workflow variable. The context injection script reads\n     * this on each iteration and prepends it to the LLM's user message as {@code\n     * [SIGNALS]...[/SIGNALS]}.\n     */\n    public void signalAgent(String executionId, String message) {\n        WorkflowModel workflow = executionDAO.getWorkflow(executionId, false);\n        if (workflow == null) {\n            throw new NotFoundException(\"No agent execution found: \" + executionId);","sourceCodeStart":667,"sourceCodeEnd":703,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/agentspan/src/main/java/org/conductoross/conductor/ai/agentspan/runtime/service/AgentService.java#L667-L703","documentation":"Thrown by AgentService.stopAgent when executionDAO.getWorkflow(executionId, false) returns null. stopAgent sets the _stop_requested workflow variable so the agent's DoWhile loop exits gracefully after the current iteration. A null workflow means no execution exists with that ID. NotFoundException maps to HTTP 404.","triggerScenarios":"Calling stopAgent with a non-existent or already-deleted execution ID; the execution finished and was pruned before the stop call arrived; typo in the execution ID.","commonSituations":"User clicks stop in the UI after the agent already completed and its record was removed; SDK retries a stop call after the execution was terminated by another path; stale execution ID from a cached UI state.","solutions":["Check getStatus(executionId) before calling stopAgent — if the workflow is terminal or absent, no stop is needed.","Catch NotFoundException and treat it as success (the execution is already stopped/gone).","Ensure the execution ID is current (not from a stale cache)."],"exampleFix":"// before\nagentService.stopAgent(executionId);\n\n// after\ntry {\n    agentService.stopAgent(executionId);\n} catch (NotFoundException e) {\n    log.info(\"Execution {} already absent, nothing to stop\", executionId);\n}","handlingStrategy":"try-catch","validationCode":"WorkflowModel wf = executionDAO.getWorkflow(executionId, false);\nif (wf == null) {\n    log.info(\"Execution {} not found, nothing to stop\", executionId);\n    return;\n}","typeGuard":null,"tryCatchPattern":"try {\n    agentService.stopAgent(executionId);\n} catch (NotFoundException e) {\n    // Already gone — treat as stopped\n    log.info(\"Execution {} already absent\", executionId);\n}","preventionTips":["Check getStatus() before calling stopAgent.","Treat 404 on stop as success (already stopped/removed).","Avoid stale execution IDs from cached UI state."],"tags":["not-found","stop","lifecycle","execution"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}