{"record":{"id":"59eeede357bdde09","repo":"apache/shenyu","slug":"name-is-error","errorCode":null,"errorMessage":" name is error","messagePattern":" name is error","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"shenyu-spi/src/main/java/org/apache/shenyu/spi/ExtensionLoader.java","lineNumber":146,"sourceCode":"        if (StringUtils.isBlank(cachedDefaultName)) {\n            return null;\n        }\n        return getJoin(cachedDefaultName);\n    }\n    \n    /**\n     * Gets join.\n     *\n     * @param name the name\n     * @return the join.\n     */\n    public T getJoin(final String name) {\n        if (StringUtils.isBlank(name)) {\n            throw new NullPointerException(\"get join name is null\");\n        }\n        ClassEntity classEntity = getExtensionClassesEntity().get(name);\n        if (Objects.isNull(classEntity)) {\n            throw new IllegalArgumentException(name + \" name is error\");\n        }\n        if (!classEntity.isSingleton()) {\n            return (T) createExtension(classEntity);\n        }\n        Holder<Object> objectHolder = cachedInstances.get(name);\n        if (Objects.isNull(objectHolder)) {\n            cachedInstances.putIfAbsent(name, new Holder<>());\n            objectHolder = cachedInstances.get(name);\n        }\n        Object value = objectHolder.getValue();\n        if (Objects.isNull(value)) {\n            synchronized (objectHolder) {\n                value = objectHolder.getValue();\n                if (Objects.isNull(value)) {\n                    createExtension(name, objectHolder);\n                    value = objectHolder.getValue();\n                }\n            }","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/shenyu-spi/src/main/java/org/apache/shenyu/spi/ExtensionLoader.java#L128-L164","documentation":"getJoin(name) throws IllegalArgumentException when the given name does not match any @Join-annotated implementation registered under the SPI interface's META-INF/shenyu/ resource. The name lookup in the extension class map returned null, so the name is unknown to the loader.","triggerScenarios":"Calling loader.getJoin(\"nameX\") where nameX is not a key in the interface's META-INF/shenyu/<InterfaceFQN> file.","commonSituations":"Typo in configured extension name; implementation jar not on the classpath so its resource file is missing; config value naming an extension from a different project; renamed implementation without updating config.","solutions":["Check the exact name registered in META-INF/shenyu/<interface-fqcn>","Ensure the jar containing the implementation and resource file is on the classpath","Use getDefaultJoin() or a validated whitelist of names","Add the implementation with @Join(name = \"nameX\") if it is your own class"],"exampleFix":"// before\nLoadBalance lb = ExtensionLoader.getExtensionLoader(LoadBalance.class).getJoin(\"roundrobin\");\n// after\n// META-INF/shenyu/... registers \"roundRobin\" — fix the name\nLoadBalance lb = ExtensionLoader.getExtensionLoader(LoadBalance.class).getJoin(\"roundRobin\");","handlingStrategy":"try-catch","validationCode":"// verify registration before lookup\njava.net.URL res = getClass().getClassLoader().getResource(\"META-INF/shenyu/\" + LoadBalance.class.getName());\n// then confirm the configured name appears in that file","typeGuard":null,"tryCatchPattern":"try { return loader.getJoin(name); } catch (IllegalArgumentException e) { log.error(\"Unknown extension name '{}': {}\", name, e.getMessage()); return loader.getDefaultJoin(); }","preventionTips":["Keep extension names in a shared constants/enum instead of free-form strings","Keep META-INF/shenyu/ files in sync with @Join classes via tests","Include the module that registers the implementation on the classpath"],"tags":["spi","class-not-found","configuration"],"backgroundTag":"resource-not-found","analyzedSha":"567142e07261b3e615ae8850b30f4421f455cc5d","analyzedAt":"2026-09-12T10:08:21.293Z","contentChangedAt":"2026-09-12T10:08:21.293Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}