{"record":{"id":"4d18c290b881d092","repo":"conductor-oss/conductor","slug":"on-condition-requires-a-nonblank-taskname","errorCode":null,"errorMessage":"on_condition requires a nonblank taskName","messagePattern":"on_condition requires a nonblank taskName","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"agentspan/src/main/java/org/conductoross/conductor/ai/agentspan/runtime/compiler/MultiAgentCompiler.java","lineNumber":1510,"sourceCode":"            if (handoff.getTarget() == null || !targets.contains(handoff.getTarget())) {\n                throw new IllegalArgumentException(\n                        \"SWARM handoff target must name a swarm agent: \" + handoff.getTarget());\n            }\n            switch (handoff.getType()) {\n                case \"on_tool_result\" -> {\n                    if (isBlank(handoff.getToolName()) || isBlank(handoff.getResultContains())) {\n                        throw new IllegalArgumentException(\n                                \"on_tool_result requires toolName and resultContains\");\n                    }\n                }\n                case \"on_text_mention\" -> {\n                    if (isBlank(handoff.getText())) {\n                        throw new IllegalArgumentException(\"on_text_mention requires text\");\n                    }\n                }\n                case \"on_condition\" -> {\n                    if (isBlank(handoff.getTaskName())) {\n                        throw new IllegalArgumentException(\n                                \"on_condition requires a nonblank taskName\");\n                    }\n                }\n                default -> throw new IllegalStateException(\"validated above\");\n            }\n        }\n    }\n\n    private static boolean isBlank(String value) {\n        return value == null || value.isBlank();\n    }\n\n    /**\n     * First-wins handoff resolver. Explicit model transfers take precedence; declarative text and\n     * tool-result matches then follow configuration order. The returned map is consumed by the\n     * outer loop after the source case has made the transcript/state durable.\n     */\n    private static String swarmHandoffResolverScript(","sourceCodeStart":1492,"sourceCodeEnd":1528,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/agentspan/src/main/java/org/conductoross/conductor/ai/agentspan/runtime/compiler/MultiAgentCompiler.java#L1492-L1528","documentation":"Thrown when a SWARM handoff of type 'on_condition' has a null or blank 'taskName' field. The taskName names a Conductor worker task that evaluates the condition at runtime — without it the compiler cannot emit the condition-checking task, so the handoff would never fire.","triggerScenarios":"A HandoffConfig with type='on_condition' where taskName is null or blank. The check uses isBlank(), rejecting null and whitespace-only strings.","commonSituations":"Configuring a conditional handoff but forgetting to wire the condition-evaluation worker, or using the wrong field name (e.g., 'workerName' instead of 'taskName').","solutions":["Set the handoff's taskName to a non-blank string matching a registered Conductor worker task.","Ensure the named worker task is registered and deployed in the conductor task domain.","If you intended a different trigger mechanism, change the handoff type to on_tool_result or on_text_mention instead."],"exampleFix":"// before\n{\"type\": \"on_condition\", \"target\": \"escalation_agent\", \"taskName\": \"\"}\n// after\n{\"type\": \"on_condition\", \"target\": \"escalation_agent\", \"taskName\": \"check_escalation_needed\"}","handlingStrategy":"validation","validationCode":"void validateOnCondition(HandoffConfig h) {\n    if (\"on_condition\".equals(h.getType())) {\n        if (h.getTaskName() == null || h.getTaskName().isBlank()) {\n            throw new IllegalArgumentException(\"on_condition requires a non-blank taskName\");\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    compiler.compile(agentConfig);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"on_condition requires\")) {\n        // set taskName to the condition-evaluating worker task\n    }\n    throw e;\n}","preventionTips":["Ensure the taskName references a worker task that is registered and deployed.","Verify the worker task returns a boolean result the coordinator can interpret."],"tags":["swarm","handoff","on-condition","config-validation","agentspan","worker-task"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}