apache/pulsar · error · IllegalArgumentException
Not support component type
Error message
Not support component type
What it means
InstanceUtils.getProperties builds topic-property metadata marking which application (function/source/sink) owns a topic. Its switch handles FUNCTION, SOURCE, and SINK; any other ComponentType value reaches the default branch and throws IllegalArgumentException("Not support component type").
Source
Thrown at pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/InstanceUtils.java:145
functionDetails.getNamespace(),
functionDetails.getName());
}
public static Map<String, String> getProperties(FunctionDetails.ComponentType componentType,
String fullyQualifiedName, int instanceId) {
Map<String, String> properties = new HashMap<>();
switch (componentType) {
case FUNCTION:
properties.put("application", "pulsar-function");
break;
case SOURCE:
properties.put("application", "pulsar-source");
break;
case SINK:
properties.put("application", "pulsar-sink");
break;
default:
throw new IllegalArgumentException("Not support component type");
}
properties.put("id", fullyQualifiedName);
properties.put("instance_id", String.valueOf(instanceId));
try {
properties.put("instance_hostname", InetAddress.getLocalHost().getHostName());
} catch (UnknownHostException e) {
log.warn()
.attr("function", fullyQualifiedName)
.attr("instanceId", instanceId)
.exception(e)
.log("Failed to get hostname of instance");
}
return properties;
}
@SuppressWarnings("deprecation")
public static ClientBuilder createPulsarClientBuilder(String pulsarServiceUrl,
AuthenticationConfig authConfig,View on GitHub (pinned to 820761864e)
Solutions
- Pass a valid ComponentType (FUNCTION, SOURCE, or SINK) to getProperties.
- If you added a new ComponentType constant, add a case to the switch in InstanceUtils.getProperties.
- Check instance config generation code that produces the componentType field for null/unset values.
Example fix
// before InstanceUtils.getProperties(ComponentType.GO_CONNECTOR, fqn, id); // after InstanceUtils.getProperties(ComponentType.SOURCE, fqn, id);
Defensive patterns
Strategy: validation
Validate before calling
if (componentType == null || (componentType != ComponentType.FUNCTION
&& componentType != ComponentType.SOURCE && componentType != ComponentType.SINK)) {
throw new IllegalArgumentException("componentType must be FUNCTION, SOURCE, or SINK");
} Try / catch
try { props = InstanceUtils.getProperties(type, fqn, id); } catch (IllegalArgumentException e) { props = Collections.emptyMap(); } Prevention
- Always pass an explicit, non-null ComponentType
- Update the switch when adding new ComponentType constants
- Validate componentType at config-parse time
When it happens
Trigger: Calling InstanceUtils.getProperties with a component type outside the supported enum values — typically a null/unset component type or a newly added enum constant not yet handled.
Common situations: Custom function-runtime tooling that passes an unknown ComponentType; forward/backward version mismatch where a newer enum constant is passed to an older instance library.
Related errors
- Unrecognized auto_failover_policy: ${policyType}
- Unknown component type: %s
- configuredService should not be an instance of SystemTopicBa
- Invalid auto split/merge configuration: ${message}
- Unknown resource type:
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/df8bcbab018a3912.
Report an issue: GitHub.