apache/shenyu · error · ShenyuAdminException
namespace is not exist
Error message
namespace is not exist
What it means
After validating that namespaceId is present, fetchConfigs looks it up via namespaceService.findByNamespaceId and throws ShenyuAdminException("namespace is not exist") when no namespace with that id is registered in admin. The gateway must only sync namespaces the admin knows about.
Solutions
- Check the exact namespaceId in the admin dashboard (System -> Namespace) and correct the client's config to match
- Create the missing namespace in the admin dashboard/API before syncing
- If the namespace table is empty, ensure the schema was initialized from the matching db/init script for your version
Example fix
// before namespaceId=prod-01 // namespace never registered // after namespaceId=649330b6-c2d7-4f6c-9b2c-9f5c7f1b2f3a // registered in admin
Defensive patterns
Strategy: validation
Validate before calling
// before calling the API, confirm the namespace exists
ShenyuAdminResult ns = adminClient.get("/namespace/detail?id=" + namespaceId);
if (ns.getCode() != 200) { throw new IllegalStateException("namespace not registered in admin: " + namespaceId); } Try / catch
try {
return fetchConfigs(groupKeys, namespaceId);
} catch (HttpServerErrorException e) {
if (e.getResponseBodyAsString().contains("namespace is not exist")) { /* create namespace or fix id */ }
} Prevention
- Copy namespace ids from the admin dashboard, not from docs or memory
- Pin namespace ids in config per environment (dev/staging/prod) and verify at deploy time
- Recreate namespaces after DB rebuilds or version migrations
When it happens
Trigger: GET /configs/fetch with a namespaceId that does not exist in the admin's namespace table (typo, wrong environment, namespace deleted, or DB not migrated/seeded with the default namespace).
Common situations: Pointing a gateway at a different admin environment than the one the namespace was created in; copying a namespaceId from docs without registering it; database recreated without namespace records.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- namespaceId is null
- shenyu this discovery is not found in current namespace
- dynamic: result.getMessage() from…
- namespaceId is not exist
- websocket on client open failed, namespaceId is null
AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12).
Data as JSON: /api/errors/bd4e1663e3d4fa94.
Report an issue: GitHub.
Appendix: source
Thrown at shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/ConfigController.java:77
this.httpLongPollingDataChangedListener = httpLongPollingDataChangedListener;
this.namespaceService = namespaceService;
}
/**
* Fetch configs shenyu result.
*
* @param groupKeys the group keys
* @param namespaceId namespaceId
* @return the shenyu result
*/
@GetMapping("/fetch")
public ShenyuAdminResult fetchConfigs(@NotNull final String[] groupKeys, final String namespaceId) {
if (StringUtils.isEmpty(namespaceId)) {
throw new ShenyuAdminException("namespaceId is null");
}
NamespaceVO existNamespace = namespaceService.findByNamespaceId(namespaceId);
if (StringUtils.isNotEmpty(namespaceId) && ObjectUtils.isEmpty(existNamespace)) {
throw new ShenyuAdminException("namespace is not exist");
}
Map<String, ConfigData<?>> result = Maps.newHashMap();
for (String groupKey : groupKeys) {
ConfigData<?> data = httpLongPollingDataChangedListener.fetchConfig(ConfigGroupEnum.valueOf(groupKey), namespaceId);
result.put(groupKey, data);
}
return ShenyuAdminResult.success(ShenyuResultMessage.SUCCESS, result);
}
/**
* Listener.
*
* @param request the request
* @param response the response
*/
@PostMapping(value = "/listener")
public void listener(final HttpServletRequest request, final HttpServletResponse response) {
httpLongPollingDataChangedListener.doLongPolling(request, response);View on GitHub (pinned to 567142e072)