apache/shenyu · error · IllegalArgumentException
plugin not enabled for current namespace or plugin not…
Error message
%s plugin not enabled for current namespace or plugin not exist for namespaceId: %s
What it means
checkNamespacePluginRel() throws IllegalArgumentException when the plugin itself does not exist in the plugin table (pluginMapper.selectByName returns null). The formatted message names the plugin and namespaceId. This is a precondition check run by register() and doRegisterURI() to ensure the client's rpc type plugin is present before any registration proceeds.
Solutions
- Confirm the plugin exists in the admin dashboard's plugin list; if missing, re-run the DB init scripts for your database.
- Check the client's rpcType configuration maps to the expected plugin name (PluginNameAdapter.rpcTypeAdapter).
- Add/enable the corresponding shenyu plugin in admin so its row exists in the plugin table.
- Verify admin and client versions agree on plugin naming.
Example fix
// before: client config
{"rpcType": "grpc"} // grpc plugin row absent from DB
// after: run db init / insert plugin row or choose a plugin that exists, e.g.
{"rpcType": "springCloud"} Defensive patterns
Strategy: validation
Validate before calling
PluginDO plugin = pluginMapper.selectByName(pluginName);
if (plugin == null) {
throw new IllegalStateException(pluginName + " plugin row missing; run DB init scripts or enable the plugin before client registration");
} Try / catch
try {
registerService.register(metaData);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("plugin not enabled for current namespace")) {
// prompt operator to enable the plugin / verify rpcType mapping
}
throw e;
} Prevention
- Run the full DB init scripts so all plugin rows exist before clients register.
- Match admin and client versions so rpcType-to-plugin-name mapping agrees.
- Confirm the plugin appears in the admin dashboard plugin list during deployment checks.
- Verify the client's rpcType is one the deployed admin supports.
When it happens
Trigger: A client of rpcType X registers while no plugin named (per PluginNameAdapter mapping) X exists in the plugin table — e.g. the plugin module is not deployed/enabled in this admin build, or the plugin name adapter produces a name not seeded in the DB.
Common situations: Deploying an admin instance without the plugin's DB seed data; typo or version mismatch where the client's rpc type maps to a renamed plugin; fresh database missing plugin rows; client misconfigured with a rpcType the admin doesn't support.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- namespaceId is null
- namespaceId is not exist
- namespace is not exist
- doRegister Failed to execute, because selectorDO object is…
- client register param must config the appName or contextPath
AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12).
Data as JSON: /api/errors/092b3b86797b9ae2.
Report an issue: GitHub.
Appendix: source
Thrown at shenyu-admin/src/main/java/org/apache/shenyu/admin/service/register/AbstractShenyuClientRegisterServiceImpl.java:231
String handler = buildHandle(validUriList, selectorDO);
if (Objects.nonNull(handler)) {
selectorDO.setHandle(handler);
SelectorData selectorData = selectorService.buildByNameAndPluginNameAndNamespaceId(selectorName, PluginNameAdapter.rpcTypeAdapter(rpcType()), namespaceId);
selectorData.setHandle(handler);
// update db
selectorService.updateSelective(selectorDO);
// publish change event.
doDiscoveryLocal(selectorDO, pluginName, validUriList);
}
return ShenyuResultMessage.SUCCESS;
}
@Override
public void checkNamespacePluginRel(final String namespaceId, final String pluginName) {
String errorMsg = String.format("%s plugin not enabled for current namespace or plugin not exist for namespaceId: %s", pluginName, namespaceId);
PluginDO pluginDO = pluginMapper.selectByName(pluginName);
if (Objects.isNull(pluginDO)) {
throw new IllegalArgumentException(errorMsg);
}
NamespacePluginVO namespacePluginRelation = namespacePluginRelMapper.selectByPluginIdAndNamespaceId(pluginDO.getId(), namespaceId);
if (Objects.isNull(namespacePluginRelation)) {
throw new IllegalArgumentException(errorMsg);
}
}
@Override
public String doHeartbeat(final String selectorName, final List<URIRegisterDTO> uriList, final String namespaceId) {
if (CollectionUtils.isEmpty(uriList)) {
return "";
}
String pluginName = PluginNameAdapter.rpcTypeAdapter(rpcType());
SelectorDO selectorDO = selectorService.findByNameAndPluginNameAndNamespaceId(selectorName, pluginName, namespaceId);
if (Objects.isNull(selectorDO)) {
throw new ShenyuException("doHeartbeat Failed to execute,wait to retry.");
}
// update upstreamView on GitHub (pinned to 567142e072)