{"record":{"id":"b1a3b2cdfc63a65a","repo":"conductor-oss/conductor","slug":"no-pending-human-task-found-in-execution-executio","errorCode":null,"errorMessage":"No pending HUMAN task found in execution {executionId}","messagePattern":"No pending HUMAN task found in execution (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"warning","filePath":"agentspan/src/main/java/org/conductoross/conductor/ai/agentspan/runtime/service/AgentService.java","lineNumber":1257,"sourceCode":"        return streamRegistry.register(executionId, lastEventId);\n    }\n\n    /** Respond to a pending HITL task in an agent execution. */\n    public void respond(String executionId, Map<String, Object> output) {\n        log.info(\"Responding to execution {}: {}\", executionId, output);\n\n        // Find the pending task (HUMAN type, IN_PROGRESS status)\n        Workflow workflow = workflowService.getExecutionStatus(executionId, true);\n        Task pendingTask = null;\n        for (Task task : workflow.getTasks()) {\n            if (\"HUMAN\".equals(task.getTaskType()) && task.getStatus() == Task.Status.IN_PROGRESS) {\n                pendingTask = task;\n                break;\n            }\n        }\n\n        if (pendingTask == null) {\n            throw new IllegalStateException(\n                    \"No pending HUMAN task found in execution \" + executionId);\n        }\n\n        // Update the task with the human's response\n        TaskResult taskResult = new TaskResult();\n        taskResult.setTaskId(pendingTask.getTaskId());\n        taskResult.setWorkflowInstanceId(executionId);\n        taskResult.setStatus(TaskResult.Status.COMPLETED);\n        Map<String, Object> outputData =\n                new LinkedHashMap<>(\n                        pendingTask.getOutputData() != null\n                                ? pendingTask.getOutputData()\n                                : Map.of());\n        outputData.putAll(output);\n        taskResult.setOutputData(outputData);\n        taskService.updateTask(taskResult);\n        log.info(\n                \"Completed HUMAN task {} in execution {}\",","sourceCodeStart":1239,"sourceCodeEnd":1275,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/agentspan/src/main/java/org/conductoross/conductor/ai/agentspan/runtime/service/AgentService.java#L1239-L1275","documentation":"Thrown by AgentService.respond when no HUMAN-type task in IN_PROGRESS status is found in the execution. respond() is the human-in-the-loop (HITL) response endpoint — it searches the workflow's task list for a pending HUMAN task to complete with the human's output. If none exists, the execution is not currently waiting for human input. IllegalStateException maps to HTTP 409/422 depending on the controller mapping — it indicates a state precondition failure.","triggerScenarios":"Calling respond() on an execution that has no active HITL task (the agent is mid-LLM-call or between tool calls); the HUMAN task was already completed by a prior respond call; calling respond on a terminal execution; the pending task is PULL_WORKFLOW_MESSAGES (not HUMAN) but the caller assumed HITL.","commonSituations":"Double-submit of a HITL response (user clicks twice); UI polls and submits before the HUMAN task is actually scheduled; the agent moved past the HITL point due to a timeout; caller confuses a PULL_WORKFLOW_MESSAGES wait with a HUMAN task wait.","solutions":["Check getStatus() and verify there is a pending HUMAN task before calling respond().","Guard against double-submit in the UI (disable the submit button after first click).","Catch IllegalStateException and treat it as a no-op if the HITL task was already completed.","Confirm the pending tool type via getStatus().pendingTool before responding."],"exampleFix":"// before\nagentService.respond(executionId, Map.of(\"answer\", \"yes\"));\n\n// after\nAgentStatusResponse status = agentService.getStatus(executionId);\nif (status.isWaiting() && \"HUMAN\".equals(status.getPendingToolType())) {\n    agentService.respond(executionId, Map.of(\"answer\", \"yes\"));\n} else {\n    log.info(\"No pending HITL task for {}, skipping respond\", executionId);\n}","handlingStrategy":"validation","validationCode":"AgentStatusResponse status = agentService.getStatus(executionId);\nif (!status.isWaiting()\n    || !\"HUMAN\".equals(status.getPendingToolType())) {\n    return ResponseEntity.status(409)\n        .body(\"No pending HITL task in execution \" + executionId);\n}\nagentService.respond(executionId, output);","typeGuard":null,"tryCatchPattern":"try {\n    agentService.respond(executionId, output);\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"No pending HUMAN task\")) {\n        // HITL task already completed or not yet scheduled\n        log.info(\"No pending HITL task for {}\", executionId);\n        return ResponseEntity.noContent().build();\n    }\n    throw e;\n}","preventionTips":["Check getStatus() for a pending HUMAN task before calling respond().","Disable the submit button in the UI after the first click to prevent double-submit.","Treat 'no pending HUMAN task' as a benign no-op if the response was already submitted."],"tags":["illegal-state","hitl","respond","state-mismatch","human-task"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}