apache/shenyu · error · ShenyuAdminException
namespaceId is null
Error message
namespaceId is null
What it means
The /configs/fetch endpoint (long-polling config fetch) requires a namespaceId because config data is partitioned per namespace. When the query parameter is absent or empty, fetchConfigs throws ShenyuAdminException("namespaceId is null") before any lookup.
Solutions
- Add the namespaceId query parameter to the /configs/fetch request (use the default namespace id, typically 649330b6-c2d7-4f6c-9b2c-9f5c7f1b2f3a, if not using multi-namespace)
- Upgrade/reconfigure the gateway client's sync config so it sends its configured namespace
- Verify the client's shenyu.http.namespace config property is set
Example fix
// before GET /configs/fetch?groupKeys=PLUGIN,SELECTOR // after GET /configs/fetch?groupKeys=PLUGIN,SELECTOR&namespaceId=649330b6-c2d7-4f6c-9b2c-9f5c7f1b2f3a
Defensive patterns
Strategy: validation
Validate before calling
if (namespaceId == null || namespaceId.isEmpty()) {
throw new IllegalArgumentException("namespaceId is required for /configs/fetch");
} Try / catch
try {
ShenyuAdminResult r = restTemplate.getForObject(url, ShenyuAdminResult.class);
} catch (HttpClientErrorException e) {
if (e.getResponseBodyAsString().contains("namespaceId is null")) { /* add namespaceId param and retry */ }
} Prevention
- Always include namespaceId in config-sync URLs; default to the admin's default namespace id
- Keep gateway sync clients on versions matching the admin's namespace-aware API
- Add integration tests that call /configs/fetch with the production client parameters
When it happens
Trigger: A gateway/client calls GET /configs/fetch?groupKeys=... without a namespaceId parameter, or sends it empty; admin API consumers built against older single-namespace versions of the sync protocol.
Common situations: Upgrading a gateway to a namespace-aware ShenYu version while its config-sync URL still omits namespaceId; hand-written scripts or SDKs hitting the admin HTTP API directly.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- namespace is not exist
- namespaceId is not exist
- namespace is not exist
- plugin not enabled for current namespace or plugin not…
- dynamic: result.getMessage() from…
AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12).
Data as JSON: /api/errors/9a03235ac9f281a7.
Report an issue: GitHub.
Appendix: source
Thrown at shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/ConfigController.java:73
private final NamespaceService namespaceService;
public ConfigController(final HttpLongPollingDataChangedListener httpLongPollingDataChangedListener,
final NamespaceService namespaceService) {
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 responseView on GitHub (pinned to 567142e072)