{"record":{"id":"2b9035fbe4756616","repo":"apache/shenyu","slug":"apppath-exist-under-those-namespace","errorCode":null,"errorMessage":"appPath exist under those namespace!","messagePattern":"appPath exist under those namespace!","errorType":"exception","errorClass":"ShenyuAdminException","httpStatus":null,"severity":"error","filePath":"shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/NamespaceServiceImpl.java","lineNumber":161,"sourceCode":"        List<RuleDO> ruleDOList = ruleMapper.selectAllByNamespaceIds(namespaceIdList);\n        if (CollectionUtils.isNotEmpty(ruleDOList)) {\n            throw new ShenyuAdminException(\"rule exist under those namespace!\");\n        }\n        List<SelectorDO> selectorDOS = selectorMapper.selectAllByNamespaceIds(namespaceIdList);\n        if (CollectionUtils.isNotEmpty(selectorDOS)) {\n            throw new ShenyuAdminException(\"selector exist under those namespace!\");\n        }\n        List<NamespacePluginVO> namespacePluginVOS = namespacePluginRelMapper.selectAllByNamespaceIds(namespaceIdList);\n        if (CollectionUtils.isNotEmpty(namespacePluginVOS)) {\n            throw new ShenyuAdminException(\"Plugins exist under those namespace!\");\n        }\n        List<MetaDataDO> metaDataDOList = metaDataMapper.findAllByNamespaceIds(namespaceIdList);\n        if (CollectionUtils.isNotEmpty(metaDataDOList)) {\n            throw new ShenyuAdminException(\"metaData exist under those namespace!\");\n        }\n        List<AppAuthDO> appPathDOList = appAuthMapper.findByNamespaceIds(namespaceIdList);\n        if (CollectionUtils.isNotEmpty(appPathDOList)) {\n            throw new ShenyuAdminException(\"appPath exist under those namespace!\");\n        }\n        namespaceMapper.deleteByIds(ids);\n        return ShenyuResultMessage.DELETE_SUCCESS;\n    }\n\n    @Override\n    public NamespaceVO findById(final String id) {\n        return NamespaceTransfer.INSTANCE.mapToVo(namespaceMapper.selectById(id));\n    }\n\n    @Override\n    public NamespaceVO findByNamespaceId(final String namespaceId) {\n        return NamespaceTransfer.INSTANCE.mapToVo(namespaceMapper.selectByNamespaceId(namespaceId));\n    }\n\n    @Override\n    public List<NamespaceVO> list(final String name) {\n        ","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/NamespaceServiceImpl.java#L143-L179","documentation":"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.","triggerScenarios":"Calling NamespaceService.delete when appAuthMapper.findByNamespaceIds returns rows for the target namespaces. All earlier checks (rules, selectors, plugins, metadata) must have passed.","commonSituations":"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.","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"],"exampleFix":"// before\nnamespaceService.delete(Arrays.asList(\"ns-auth\")); // throws: appPath exist under those namespace!\n// after\nappAuthService.deleteByNamespace(\"ns-auth\"); // remove app auth entries first\nnamespaceService.delete(Arrays.asList(\"ns-auth\"));","handlingStrategy":"validation","validationCode":"if (appAuthMapper.findByNamespaceIds(namespaceIds).isEmpty()) {\n    namespaceService.delete(namespaceIds);\n}","typeGuard":null,"tryCatchPattern":"try {\n    namespaceService.delete(namespaceIds);\n} catch (ShenyuAdminException e) {\n    if (e.getMessage().contains(\"appPath exist\")) {\n        // delete app-auth entries for the namespace, then retry\n    } else {\n        throw e;\n    }\n}","preventionTips":["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"],"tags":["shenyu","admin","namespace","app-auth","referential-integrity"],"backgroundTag":"invalid-state-transition","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"}