conductor-oss/conductor · error · IllegalArgumentException
Unknown termination type in nested composite: ${type}
Error message
Unknown termination type in nested composite: ${type} What it means
Thrown by buildNestedSubConditionBody() when a sub-condition inside a nested composite (an and/or inside another and/or) has an unrecognized type. This is the same validation as errors 33/35 but for the deepest nesting level reached via the buildInlineComposite recursion path.
Source
Thrown at agentspan/src/main/java/org/conductoross/conductor/ai/agentspan/runtime/compiler/TerminationCompiler.java:468
return sb.toString();
}
/**
* Build an inline sub-condition body for use inside a nested composite. Variable names are
* prefixed to avoid collisions.
*/
private static String buildNestedSubConditionBody(
TerminationConfig sub, String varName, int parentIndex, int childIndex) {
String type = sub.getType();
return switch (type) {
case "text_mention" -> buildInlineTextMention(sub, varName);
case "stop_message" -> buildInlineStopMessage(sub, varName);
case "max_message" -> buildInlineMaxMessage(sub, varName);
case "token_usage" -> buildInlineTokenUsage(sub, varName);
case "and" -> buildInlineComposite(sub, varName, true, parentIndex * 10 + childIndex);
case "or" -> buildInlineComposite(sub, varName, false, parentIndex * 10 + childIndex);
default ->
throw new IllegalArgumentException(
"Unknown termination type in nested composite: " + type);
};
}
}
View on GitHub (pinned to cf7c3e4a8a)
Solutions
- Traverse the full termination tree to find the specific sub-condition at the deepest nesting level whose type is invalid.
- Fix that sub-condition's type to one of: text_mention, stop_message, max_message, token_usage, and, or.
- Use a recursive validator to catch all type errors before compilation.
Example fix
// before: deepest nested sub has typo "stop" instead of "stop_message" // and > or > [max_message, stop] // after: fix "stop" to "stop_message"
Defensive patterns
Strategy: validation
Validate before calling
private static final Set<String> VALID = Set.of(
"text_mention", "stop_message", "max_message", "token_usage", "and", "or");
void validateAllNestedTypes(TerminationConfig config) {
if (config.getType() == null || !VALID.contains(config.getType())) {
throw new IllegalArgumentException("Invalid type at depth: " + config.getType());
}
if (config.getConditions() != null) {
for (TerminationConfig sub : config.getConditions()) {
validateAllNestedTypes(sub); // recurse into all nesting levels
}
}
} Type guard
static boolean allNestedTypesValid(TerminationConfig root) {
if (root.getType() == null || !VALID_TERM_TYPES.contains(root.getType())) return false;
if (root.getConditions() == null) return true;
return root.getConditions().stream().allMatch(x -> allNestedTypesValid(x));
} Try / catch
try {
String script = TerminationCompiler.buildTerminationScript(rootConfig);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("Unknown termination type in nested composite")) {
// recursively find the bad type at the deepest nesting level
}
throw e;
} Prevention
- Run a recursive type validator over the entire termination tree before compiling.
- For deeply nested composites, log the tree structure to aid debugging.
- Minimize nesting depth — flatten where possible.
When it happens
Trigger: A nested composite TerminationConfig whose conditions list contains a TerminationConfig with a null or unrecognized type string. The error is caught at the nested level (parentIndex > 0), distinguishing it from error 35 which fires at the first nesting level.
Common situations: Same as error 35 but occurring at a deeper nesting level. A sub-condition inside a nested composite has a typo or null type. Harder to debug because the nesting obscures which condition is invalid.
Related errors
- Composite termination must have at least one sub-condition
- Composite termination (${isAnd ? "and" : "or"}) must have at
- Unknown termination type in composite: ${type}
- Unknown termination type: ${type}
- SWARM handoff type must be on_tool_result, on_text_mention,
AI-assisted analysis of conductor-oss/conductor@cf7c3e4a8a (2026-08-14).
Data as JSON: /api/errors/6a40f5cc02692d01.
Report an issue: GitHub.