apache/shenyu · error · ShenyuAdminException
appPath exist under those namespace!
Error message
appPath exist under those namespace!
What it means
ShenYu admin refuses to delete a namespace while app-auth entries (application path credentials) still reference it. This is the last referential-integrity check in the delete flow; if appAuthMapper.findByNamespaceIds returns rows, deletion is aborted with this ShenyuAdminException.
Solutions
- Delete the app-auth entries for the namespace first (dashboard authentication page or appAuth service API)
- Clear the auth rows for the namespaceIds in the app_auth table, then retry the delete
- Ensure no clients still depend on those app credentials before removing them
Example fix
// before
namespaceService.delete(Arrays.asList("ns-auth")); // throws: appPath exist under those namespace!
// after
appAuthService.deleteByNamespace("ns-auth"); // remove app auth entries first
namespaceService.delete(Arrays.asList("ns-auth")); Defensive patterns
Strategy: validation
Validate before calling
if (appAuthMapper.findByNamespaceIds(namespaceIds).isEmpty()) {
namespaceService.delete(namespaceIds);
} Try / catch
try {
namespaceService.delete(namespaceIds);
} catch (ShenyuAdminException e) {
if (e.getMessage().contains("appPath exist")) {
// delete app-auth entries for the namespace, then retry
} else {
throw e;
}
} Prevention
- Delete app authentication entries before namespace removal
- Confirm no gateway consumers still use the app keys bound to the namespace
- Run through the full teardown checklist: rules, selectors, plugins, metadata, app auth
When it happens
Trigger: Calling NamespaceService.delete when appAuthMapper.findByNamespaceIds returns rows for the target namespaces. All earlier checks (rules, selectors, plugins, metadata) must have passed.
Common situations: Deleting a namespace that still has authentication/app-key configurations created for gateway access control; cleaning up a namespace where app auth paths were configured but other resources were already removed.
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!
- Plugins exist under those namespace!
- metaData 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/2b9035fbe4756616.
Report an issue: GitHub.
Appendix: source
Thrown at shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/NamespaceServiceImpl.java:161
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));
}
@Override
public NamespaceVO findByNamespaceId(final String namespaceId) {
return NamespaceTransfer.INSTANCE.mapToVo(namespaceMapper.selectByNamespaceId(namespaceId));
}
@Override
public List<NamespaceVO> list(final String name) {
View on GitHub (pinned to 567142e072)