{"record":{"id":"df8bcbab018a3912","repo":"apache/pulsar","slug":"not-support-component-type","errorCode":null,"errorMessage":"Not support component type","messagePattern":"Not support component type","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/InstanceUtils.java","lineNumber":145,"sourceCode":"                functionDetails.getNamespace(),\n                functionDetails.getName());\n    }\n\n    public static Map<String, String> getProperties(FunctionDetails.ComponentType componentType,\n                                                    String fullyQualifiedName, int instanceId) {\n        Map<String, String> properties = new HashMap<>();\n        switch (componentType) {\n            case FUNCTION:\n                properties.put(\"application\", \"pulsar-function\");\n                break;\n            case SOURCE:\n                properties.put(\"application\", \"pulsar-source\");\n                break;\n            case SINK:\n                properties.put(\"application\", \"pulsar-sink\");\n                break;\n            default:\n                throw new IllegalArgumentException(\"Not support component type\");\n        }\n        properties.put(\"id\", fullyQualifiedName);\n        properties.put(\"instance_id\", String.valueOf(instanceId));\n        try {\n            properties.put(\"instance_hostname\", InetAddress.getLocalHost().getHostName());\n        } catch (UnknownHostException e) {\n            log.warn()\n                    .attr(\"function\", fullyQualifiedName)\n                    .attr(\"instanceId\", instanceId)\n                    .exception(e)\n                    .log(\"Failed to get hostname of instance\");\n        }\n        return properties;\n    }\n\n    @SuppressWarnings(\"deprecation\")\n    public static ClientBuilder createPulsarClientBuilder(String pulsarServiceUrl,\n                                                          AuthenticationConfig authConfig,","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/InstanceUtils.java#L127-L163","documentation":"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\").","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nInstanceUtils.getProperties(ComponentType.GO_CONNECTOR, fqn, id);\n// after\nInstanceUtils.getProperties(ComponentType.SOURCE, fqn, id);","handlingStrategy":"validation","validationCode":"if (componentType == null || (componentType != ComponentType.FUNCTION\n    && componentType != ComponentType.SOURCE && componentType != ComponentType.SINK)) {\n    throw new IllegalArgumentException(\"componentType must be FUNCTION, SOURCE, or SINK\");\n}","typeGuard":null,"tryCatchPattern":"try { props = InstanceUtils.getProperties(type, fqn, id); } catch (IllegalArgumentException e) { props = Collections.emptyMap(); }","preventionTips":["Always pass an explicit, non-null ComponentType","Update the switch when adding new ComponentType constants","Validate componentType at config-parse time"],"tags":["pulsar-functions","configuration","enum","illegal-argument"],"backgroundTag":"unsupported-component-type","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}