conductor-oss/conductor · error · IllegalArgumentException

on_condition requires a nonblank taskName

Error message

on_condition requires a nonblank taskName

What it means

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.

Source

Thrown at agentspan/src/main/java/org/conductoross/conductor/ai/agentspan/runtime/compiler/MultiAgentCompiler.java:1510

            if (handoff.getTarget() == null || !targets.contains(handoff.getTarget())) {
                throw new IllegalArgumentException(
                        "SWARM handoff target must name a swarm agent: " + handoff.getTarget());
            }
            switch (handoff.getType()) {
                case "on_tool_result" -> {
                    if (isBlank(handoff.getToolName()) || isBlank(handoff.getResultContains())) {
                        throw new IllegalArgumentException(
                                "on_tool_result requires toolName and resultContains");
                    }
                }
                case "on_text_mention" -> {
                    if (isBlank(handoff.getText())) {
                        throw new IllegalArgumentException("on_text_mention requires text");
                    }
                }
                case "on_condition" -> {
                    if (isBlank(handoff.getTaskName())) {
                        throw new IllegalArgumentException(
                                "on_condition requires a nonblank taskName");
                    }
                }
                default -> throw new IllegalStateException("validated above");
            }
        }
    }

    private static boolean isBlank(String value) {
        return value == null || value.isBlank();
    }

    /**
     * First-wins handoff resolver. Explicit model transfers take precedence; declarative text and
     * tool-result matches then follow configuration order. The returned map is consumed by the
     * outer loop after the source case has made the transcript/state durable.
     */
    private static String swarmHandoffResolverScript(

View on GitHub (pinned to cf7c3e4a8a)

Solutions

  1. Set the handoff's taskName to a non-blank string matching a registered Conductor worker task.
  2. Ensure the named worker task is registered and deployed in the conductor task domain.
  3. If you intended a different trigger mechanism, change the handoff type to on_tool_result or on_text_mention instead.

Example fix

// before
{"type": "on_condition", "target": "escalation_agent", "taskName": ""}
// after
{"type": "on_condition", "target": "escalation_agent", "taskName": "check_escalation_needed"}
Defensive patterns

Strategy: validation

Validate before calling

void validateOnCondition(HandoffConfig h) {
    if ("on_condition".equals(h.getType())) {
        if (h.getTaskName() == null || h.getTaskName().isBlank()) {
            throw new IllegalArgumentException("on_condition requires a non-blank taskName");
        }
    }
}

Try / catch

try {
    compiler.compile(agentConfig);
} catch (IllegalArgumentException e) {
    if (e.getMessage().contains("on_condition requires")) {
        // set taskName to the condition-evaluating worker task
    }
    throw e;
}

Prevention

When it happens

Trigger: A HandoffConfig with type='on_condition' where taskName is null or blank. The check uses isBlank(), rejecting null and whitespace-only strings.

Common situations: Configuring a conditional handoff but forgetting to wire the condition-evaluation worker, or using the wrong field name (e.g., 'workerName' instead of 'taskName').

Related errors


AI-assisted analysis of conductor-oss/conductor@cf7c3e4a8a (2026-08-14). Data as JSON: /api/errors/4d18c290b881d092. Report an issue: GitHub.