alibaba/spring-ai-alibaba · warning · IllegalArgumentException
unknown component type: + componentType.getValue()
Error message
unknown component type: + componentType.getValue()
What it means
InterruptionHook.apply() accepts human feedback as a List and expects every element to be a Spring AI Message. Non-Message elements are dropped with this warning; only the valid Message instances are converted into feedback messages appended to the conversation when resuming.
Source
Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/agent/tool/AppComponentToolCallback.java:103
if (componentType == AppComponentTypeEnum.Agent) {
AgentResponse response = appComponentManager.executeAgentComponent(request);
if (!response.isSuccess()) {
return JsonUtils.toJson(response.getError());
}
return String.valueOf(response.getMessage().getContent());
}
else if (componentType == AppComponentTypeEnum.Workflow) {
WorkflowResponse response = appComponentManager.executeWorkflowComponent(request);
if (!response.isSuccess()) {
return JsonUtils.toJson(response.getError());
}
return String.valueOf(response.getMessage().getContent());
}
else {
throw new IllegalArgumentException("unknown component type: " + componentType.getValue());
}
}
/**
* Returns tool metadata indicating direct return behavior.
*/
@NotNull
@Override
public ToolMetadata getToolMetadata() {
return ToolMetadata.builder().returnDirect(true).build();
}
@Override
public String getId() {
return appComponentId;
}
@OverrideView on GitHub (pinned to f82da0b50f)
Solutions
- Wrap each feedback item in a Message, e.g. new UserMessage(String), before passing the list
- Send feedback as a plain String or a single UserMessage instead of a mixed list
- Fix client-side serialization so items deserialize as Message
- If the non-Message items were intentional context, fold their content into a UserMessage string
Example fix
// before
hook.apply(state, List.of("please use the safe tool"));
// after
hook.apply(state, List.of(new UserMessage("please use the safe tool"))); Defensive patterns
Strategy: type-guard
Validate before calling
Object feedback = ...;
if (feedback instanceof List<?> list) {
boolean allMessages = list.stream().allMatch(i -> i instanceof Message || i == null);
if (!allMessages) log.warn("Feedback list contains non-Message items");
} Type guard
boolean isMessageFeedback(Object feedback) {
return feedback instanceof Message
|| feedback instanceof String
|| (feedback instanceof List<?> l && l.stream().allMatch(i -> i instanceof Message));
} Prevention
- Wrap raw strings as new UserMessage(...) before adding to feedback lists
- Type feedback collections as List<Message> at compile time
- Add client-side deserialization tests that assert Message types
When it happens
Trigger: Resume/interrupt resume API called with feedback that is a List containing at least one element that is not a Message instance (e.g. a raw String, Map, or DTO inside the list).
Common situations: Passing plain strings or maps in a list instead of wrapping each as UserMessage; client JSON deserialization producing generic objects; refactors that changed feedback element types.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- Multiple tools with the same name (%s)
- extra tool param should be map
- INVALID_PARAMS
- WORKFLOW_CONFIG_INVALID
- App spec is not Agent
AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09).
Data as JSON: /api/errors/e27ff4b5f494c108.
Report an issue: GitHub.