apache/shenyu · error · ShenyuAdminException
Plugins exist under those namespace!
Error message
Plugins exist under those namespace!
What it means
ShenYu admin refuses to delete a namespace while plugin-to-namespace relations still exist. The delete flow checks selectors first, then namespacePluginRelMapper; if plugin relations exist under the target namespaces, deletion is aborted with this ShenyuAdminException to prevent orphaned plugin configuration.
Solutions
- Remove the plugin-namespace relations first (disable/delete the plugin bindings for that namespace in the dashboard plugin config)
- Delete plugin relations via the namespacePlugin API before calling delete
- Inspect the plugin relation table for the namespaceIds and clear those rows, then retry
Example fix
// before
namespaceService.delete(Arrays.asList("ns-test")); // throws: Plugins exist under those namespace!
// after
namespacePluginService.deleteByNamespaceId("ns-test"); // unbind plugins first
namespaceService.delete(Arrays.asList("ns-test")); Defensive patterns
Strategy: validation
Validate before calling
if (namespacePluginRelMapper.selectAllByNamespaceIds(namespaceIds).isEmpty()) {
namespaceService.delete(namespaceIds);
} Try / catch
try {
namespaceService.delete(namespaceIds);
} catch (ShenyuAdminException e) {
if (e.getMessage().contains("Plugins exist")) {
// unbind plugin relations for the namespace, then retry
} else {
throw e;
}
} Prevention
- Disable per-namespace plugin bindings before deleting the namespace
- Audit plugin-namespace relations during namespace decommissioning
- Use the dashboard plugin page to confirm no plugins are attached to the target namespace
When it happens
Trigger: Calling NamespaceService.delete for a namespace that has plugin bindings (rows in the namespace-plugin relation table for those namespaceIds). Selectors must already be empty for the flow to reach this check.
Common situations: Deleting a namespace where plugins (e.g. divide, hystrix, logging plugins) were enabled per-namespace but no selectors/metadata remain; cleanup of test namespaces that had plugin configuration enabled.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- rule exist under those namespace!
- selector exist under those namespace!
- metaData exist under those namespace!
- appPath exist under those namespace!
- shenyu this discovery is not found in current namespace
AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12).
Data as JSON: /api/errors/f516aed4b1d9319a.
Report an issue: GitHub.
Appendix: source
Thrown at shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/NamespaceServiceImpl.java:153
public String delete(final List<String> ids) {
if (ids.contains(Constants.DEFAULT_NAMESPACE_PRIMARY_KEY)) {
throw new ShenyuAdminException(AdminConstants.SYS_DEFAULT_NAMESPACE_ID_DELETE);
}
List<String> namespaceIdList = namespaceMapper.selectByIds(ids).stream().map(NamespaceDO::getNamespaceId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(namespaceIdList)) {
throw new ShenyuAdminException(AdminConstants.SYS_NAMESPACE_ID_NOT_EXIST);
}
List<RuleDO> ruleDOList = ruleMapper.selectAllByNamespaceIds(namespaceIdList);
if (CollectionUtils.isNotEmpty(ruleDOList)) {
throw new ShenyuAdminException("rule exist under those namespace!");
}
List<SelectorDO> selectorDOS = selectorMapper.selectAllByNamespaceIds(namespaceIdList);
if (CollectionUtils.isNotEmpty(selectorDOS)) {
throw new ShenyuAdminException("selector exist under those namespace!");
}
List<NamespacePluginVO> namespacePluginVOS = namespacePluginRelMapper.selectAllByNamespaceIds(namespaceIdList);
if (CollectionUtils.isNotEmpty(namespacePluginVOS)) {
throw new ShenyuAdminException("Plugins exist under those namespace!");
}
List<MetaDataDO> metaDataDOList = metaDataMapper.findAllByNamespaceIds(namespaceIdList);
if (CollectionUtils.isNotEmpty(metaDataDOList)) {
throw new ShenyuAdminException("metaData exist under those namespace!");
}
List<AppAuthDO> appPathDOList = appAuthMapper.findByNamespaceIds(namespaceIdList);
if (CollectionUtils.isNotEmpty(appPathDOList)) {
throw new ShenyuAdminException("appPath exist under those namespace!");
}
namespaceMapper.deleteByIds(ids);
return ShenyuResultMessage.DELETE_SUCCESS;
}
@Override
public NamespaceVO findById(final String id) {
return NamespaceTransfer.INSTANCE.mapToVo(namespaceMapper.selectById(id));
}
View on GitHub (pinned to 567142e072)