{"record":{"id":"23e40b795e0e39e6","repo":"apache/dubbo","slug":"unsupported-generic-type-generic-23e40b","errorCode":null,"errorMessage":"Unsupported generic type <generic>","messagePattern":"Unsupported generic type <generic>","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"dubbo-common/src/main/java/org/apache/dubbo/config/ServiceConfigBase.java","lineNumber":373,"sourceCode":"        return providerIds;\n    }\n\n    public void setProviderIds(String providerIds) {\n        this.providerIds = providerIds;\n    }\n\n    public String getGeneric() {\n        return generic;\n    }\n\n    public void setGeneric(String generic) {\n        if (StringUtils.isEmpty(generic)) {\n            return;\n        }\n        if (ProtocolUtils.isValidGenericValue(generic)) {\n            this.generic = generic;\n        } else {\n            throw new IllegalArgumentException(\"Unsupported generic type \" + generic);\n        }\n    }\n\n    @Transient\n    public ServiceMetadata getServiceMetadata() {\n        return serviceMetadata;\n    }\n\n    @Override\n    @Transient\n    @Parameter(excluded = true, attribute = false)\n    public List<String> getPrefixes() {\n        List<String> prefixes = new ArrayList<>();\n        // dubbo.service.{interface-name}\n        prefixes.add(DUBBO + \".service.\" + interfaceName);\n        return prefixes;\n    }\n","sourceCodeStart":355,"sourceCodeEnd":391,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-common/src/main/java/org/apache/dubbo/config/ServiceConfigBase.java#L355-L391","documentation":"Thrown by ServiceConfigBase.setGeneric when the supplied generic value is not recognized. Valid values are: 'true', 'nativejava', 'bean', 'protobuf-json', 'gson', 'raw.return', and 'false' (case-insensitive for the boolean). Any other string is rejected.","triggerScenarios":"Calling setGeneric(String) with a value that ProtocolUtils.isValidGenericValue returns false for — i.e. not one of the supported generic serialization identifiers and not 'false'.","commonSituations":"Typo in the generic value (e.g. 'truee', 'json', 'generic'). Passing a value valid for a newer/older Dubbo version than the one in use (e.g. 'protobuf-json' on an old version). Custom serialization alias not registered. Misreading docs and using an unsupported identifier.","solutions":["Use one of the supported values: true, nativejava, bean, protobuf-json, gson, raw.return, false.","Leave generic unset if you do not need generic invocation.","Verify the value against the Dubbo version in use; upgrade or align the value accordingly."],"exampleFix":"// before\nserviceConfig.setGeneric(\"json\"); // unsupported\n\n// after\nserviceConfig.setGeneric(\"gson\"); // or \"true\" for default","handlingStrategy":"validation","validationCode":"java.util.Set<String> valid = java.util.Set.of(\n    \"true\", \"nativejava\", \"bean\", \"protobuf-json\", \"gson\", \"raw.return\", \"false\");\nif (generic != null && !valid.contains(generic.toLowerCase(java.util.Locale.ROOT))) {\n    throw new IllegalArgumentException(\"Unsupported generic type: \" + generic\n        + \"; valid: \" + valid);\n}\nserviceConfig.setGeneric(generic);","typeGuard":"static boolean isValidGeneric(String g) {\n    return g == null || org.apache.dubbo.rpc.support.ProtocolUtils.isValidGenericValue(g);\n}","tryCatchPattern":"try {\n    serviceConfig.setGeneric(value);\n} catch (IllegalArgumentException e) {\n    // value was unsupported; correct to a supported generic type or leave unset\n    log.warn(\"Ignoring unsupported generic value {}\", value);\n}","preventionTips":["Use only the documented generic values for your Dubbo version.","Validate user-supplied config before applying.","Leave generic unset when generic invocation is not required."],"tags":["service-config","generic","validation"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}