apache/dubbo · error · IllegalArgumentException
Extension name == null
Error message
Extension name == null
What it means
Thrown by ExtensionLoader.getLoadedExtension(String name) when name is null, empty, or whitespace-only. This method returns an already-loaded extension instance without triggering a load; a blank name makes the cache lookup meaningless. The check uses StringUtils.isEmpty which catches both null and empty string.
Source
Thrown at dubbo-common/src/main/java/org/apache/dubbo/common/extension/ExtensionLoader.java:510
return true;
}
}
return false;
}
/**
* Get extension's instance. Return <code>null</code> if extension is not found or is not initialized. Pls. note
* that this method will not trigger extension load.
* <p>
* In order to trigger extension load, call {@link #getExtension(String)} instead.
*
* @see #getExtension(String)
*/
@SuppressWarnings("unchecked")
public T getLoadedExtension(String name) {
checkDestroyed();
if (StringUtils.isEmpty(name)) {
throw new IllegalArgumentException("Extension name == null");
}
Holder<Object> holder = getOrCreateHolder(name);
return (T) holder.get();
}
private Holder<Object> getOrCreateHolder(String name) {
Holder<Object> holder = cachedInstances.get(name);
if (holder == null) {
cachedInstances.putIfAbsent(name, new Holder<>());
holder = cachedInstances.get(name);
}
return holder;
}
/**
* Return the list of extensions which are already loaded.
* <p>
* Usually {@link #getSupportedExtensions()} should be called in order to get all extensions.View on GitHub (pinned to 3a3043227f)
Solutions
- Validate the name argument is non-null and non-empty before calling getLoadedExtension.
- If the name originates from a URL parameter, provide a fallback default: url.getParameter("key", "defaultValue").
- If the name is optional, check hasExtension or use getOrDefaultExtension instead of getLoadedExtension.
Example fix
// before
String name = url.getParameter("loadbalance");
T ext = loader.getLoadedExtension(name); // name is null
// after
String name = url.getParameter("loadbalance");
if (StringUtils.isNotEmpty(name)) {
T ext = loader.getLoadedExtension(name);
} Defensive patterns
Strategy: validation
Validate before calling
if (StringUtils.isEmpty(name)) {
return null; // or throw a more descriptive exception
}
T ext = loader.getLoadedExtension(name); Type guard
static boolean isValidExtensionName(String name) {
return name != null && !name.trim().isEmpty();
} Try / catch
try {
T ext = loader.getLoadedExtension(name);
} catch (IllegalArgumentException e) {
if (e.getMessage().equals("Extension name == null")) {
log.warn("Extension name was null/empty — treating as not loaded");
return null;
}
throw e;
} Prevention
- Validate extension names from URL parameters or config before passing to getLoadedExtension.
- Use url.getParameter("key", "defaultName") to provide a fallback when the parameter is absent.
- Encapsulate name resolution in a helper method that handles null/empty centrally.
When it happens
Trigger: Calling getLoadedExtension(null), getLoadedExtension(""), or getLoadedExtension(" ") when the name comes from an unvalidated external source, a URL parameter that was absent, or a configuration value that defaulted to null.
Common situations: A URL parameter key like 'serializer' is absent and code calls loader.getLoadedExtension(url.getParameter("serializer")) which returns null. A configuration property is not set, resolving to null, and is passed directly. Dynamic dispatch logic computes a null name from a map lookup that missed.
Related errors
- Extension type == null
- Extension type (${type}) is not an interface!
- Extension type (${type}) is not an extension, because it is
- Not find extension: ${name}
- Extension name is blank (Extension ${type})!
AI-assisted analysis of apache/dubbo@3a3043227f (2026-08-14).
Data as JSON: /api/errors/2c4abaeed84ff1e0.
Report an issue: GitHub.