{"record":{"id":"6c7d77ebbd085094","repo":"apache/dolphinscheduler","slug":"request-params-not-valid-error-6c7d77","errorCode":"REQUEST_PARAMS_NOT_VALID_ERROR","errorMessage":"REQUEST_PARAMS_NOT_VALID_ERROR","messagePattern":"REQUEST_PARAMS_NOT_VALID_ERROR","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/K8SNamespaceServiceImpl.java","lineNumber":117,"sourceCode":"        return result;\n    }\n\n    /**\n     * register namespace in db,need to create namespace in k8s first\n     *\n     * @param loginUser    login user\n     * @param namespace    namespace\n     * @param clusterCode  k8s not null\n     */\n    @Override\n    public K8sNamespace registerK8sNamespace(User loginUser, String namespace, Long clusterCode) {\n        if (isNotAdmin(loginUser)) {\n            throw new ServiceException(Status.USER_NO_OPERATION_PERM);\n        }\n\n        if (StringUtils.isEmpty(namespace)) {\n            log.warn(\"Parameter namespace is empty.\");\n            throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, Constants.NAMESPACE);\n        }\n\n        if (clusterCode == null) {\n            log.warn(\"Parameter clusterCode is null.\");\n            throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, Constants.CLUSTER);\n        }\n\n        if (checkNamespaceExistInDb(namespace, clusterCode)) {\n            log.warn(\"K8S namespace already exists.\");\n            throw new ServiceException(Status.K8S_NAMESPACE_EXIST, namespace, clusterCode);\n        }\n\n        Cluster cluster = clusterDao.queryByClusterCode(clusterCode);\n        if (cluster == null) {\n            log.error(\"Cluster does not exist, clusterCode:{}\", clusterCode);\n            throw new ServiceException(Status.CLUSTER_NOT_EXISTS, namespace, clusterCode);\n        }\n","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/K8SNamespaceServiceImpl.java#L99-L135","documentation":"REQUEST_PARAMS_NOT_VALID_ERROR with parameter 'namespace' is thrown when registerK8sNamespace receives an empty or null namespace string. The parameter check runs after the admin check and rejects the request before any persistence.","triggerScenarios":"Calling the create-K8s-namespace API with namespace omitted, null, or an empty string.","commonSituations":"Front-end form submitted without the namespace field; API automation passing an empty body field; whitespace-only input trimmed to empty.","solutions":["Provide a non-empty namespace in the request body and retry.","Validate the namespace field client-side before submitting.","Check for whitespace-only values and trim/require real content."],"exampleFix":"// before\nregisterK8sNamespace(user, \"\", clusterCode); // throws\n// after\nif (namespace == null || namespace.isEmpty()) throw new IllegalArgumentException(\"namespace required\");\nregisterK8sNamespace(user, namespace, clusterCode);","handlingStrategy":"validation","validationCode":"if (namespace == null || namespace.trim().isEmpty()) throw new IllegalArgumentException(\"namespace must be non-empty\");","typeGuard":"boolean validNamespace(String ns) { return ns != null && !ns.trim().isEmpty(); }","tryCatchPattern":"try { k8sService.registerK8sNamespace(loginUser, ns, clusterCode); } catch (ServiceException e) { if (e.getCode() == Status.REQUEST_PARAMS_NOT_VALID_ERROR) { /* surface which parameter failed (message carries param name) and re-prompt */ } else throw e; }","preventionTips":["Validate required fields client-side before submit.","Trim and check whitespace-only input.","Keep API clients in sync with the parameter contract."],"tags":["validation","parameters","k8s","dolphinscheduler"],"backgroundTag":"missing-required-argument","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}