{"record":{"id":"9a03235ac9f281a7","repo":"apache/shenyu","slug":"namespaceid-is-null","errorCode":null,"errorMessage":"namespaceId is null","messagePattern":"namespaceId is null","errorType":"validation","errorClass":"ShenyuAdminException","httpStatus":null,"severity":"error","filePath":"shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/ConfigController.java","lineNumber":73,"sourceCode":"    private final NamespaceService namespaceService;\n    \n    public ConfigController(final HttpLongPollingDataChangedListener httpLongPollingDataChangedListener,\n                            final NamespaceService namespaceService) {\n        this.httpLongPollingDataChangedListener = httpLongPollingDataChangedListener;\n        this.namespaceService = namespaceService;\n    }\n    \n    /**\n     * Fetch configs shenyu result.\n     *\n     * @param groupKeys   the group keys\n     * @param namespaceId namespaceId\n     * @return the shenyu result\n     */\n    @GetMapping(\"/fetch\")\n    public ShenyuAdminResult fetchConfigs(@NotNull final String[] groupKeys, final String namespaceId) {\n        if (StringUtils.isEmpty(namespaceId)) {\n            throw new ShenyuAdminException(\"namespaceId is null\");\n        }\n        NamespaceVO existNamespace = namespaceService.findByNamespaceId(namespaceId);\n        if (StringUtils.isNotEmpty(namespaceId) && ObjectUtils.isEmpty(existNamespace)) {\n            throw new ShenyuAdminException(\"namespace is not exist\");\n        }\n        Map<String, ConfigData<?>> result = Maps.newHashMap();\n        for (String groupKey : groupKeys) {\n            ConfigData<?> data = httpLongPollingDataChangedListener.fetchConfig(ConfigGroupEnum.valueOf(groupKey), namespaceId);\n            result.put(groupKey, data);\n        }\n        return ShenyuAdminResult.success(ShenyuResultMessage.SUCCESS, result);\n    }\n    \n    /**\n     * Listener.\n     *\n     * @param request  the request\n     * @param response the response","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/ConfigController.java#L55-L91","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nGET /configs/fetch?groupKeys=PLUGIN,SELECTOR\n// after\nGET /configs/fetch?groupKeys=PLUGIN,SELECTOR&namespaceId=649330b6-c2d7-4f6c-9b2c-9f5c7f1b2f3a","handlingStrategy":"validation","validationCode":"if (namespaceId == null || namespaceId.isEmpty()) {\n    throw new IllegalArgumentException(\"namespaceId is required for /configs/fetch\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    ShenyuAdminResult r = restTemplate.getForObject(url, ShenyuAdminResult.class);\n} catch (HttpClientErrorException e) {\n    if (e.getResponseBodyAsString().contains(\"namespaceId is null\")) { /* add namespaceId param and retry */ }\n}","preventionTips":["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"],"tags":["http-api","namespace","validation"],"backgroundTag":"missing-required-argument","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"}