apache/dolphinscheduler · error · ServiceException

REQUEST_PARAMS_NOT_VALID_ERROR

REQUEST_PARAMS_NOT_VALID_ERROR

Error message

REQUEST_PARAMS_NOT_VALID_ERROR

What it means

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.

Source

Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/K8SNamespaceServiceImpl.java:117

        return result;
    }

    /**
     * register namespace in db,need to create namespace in k8s first
     *
     * @param loginUser    login user
     * @param namespace    namespace
     * @param clusterCode  k8s not null
     */
    @Override
    public K8sNamespace registerK8sNamespace(User loginUser, String namespace, Long clusterCode) {
        if (isNotAdmin(loginUser)) {
            throw new ServiceException(Status.USER_NO_OPERATION_PERM);
        }

        if (StringUtils.isEmpty(namespace)) {
            log.warn("Parameter namespace is empty.");
            throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, Constants.NAMESPACE);
        }

        if (clusterCode == null) {
            log.warn("Parameter clusterCode is null.");
            throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, Constants.CLUSTER);
        }

        if (checkNamespaceExistInDb(namespace, clusterCode)) {
            log.warn("K8S namespace already exists.");
            throw new ServiceException(Status.K8S_NAMESPACE_EXIST, namespace, clusterCode);
        }

        Cluster cluster = clusterDao.queryByClusterCode(clusterCode);
        if (cluster == null) {
            log.error("Cluster does not exist, clusterCode:{}", clusterCode);
            throw new ServiceException(Status.CLUSTER_NOT_EXISTS, namespace, clusterCode);
        }

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Provide a non-empty namespace in the request body and retry.
  2. Validate the namespace field client-side before submitting.
  3. Check for whitespace-only values and trim/require real content.

Example fix

// before
registerK8sNamespace(user, "", clusterCode); // throws
// after
if (namespace == null || namespace.isEmpty()) throw new IllegalArgumentException("namespace required");
registerK8sNamespace(user, namespace, clusterCode);
Defensive patterns

Strategy: validation

Validate before calling

if (namespace == null || namespace.trim().isEmpty()) throw new IllegalArgumentException("namespace must be non-empty");

Type guard

boolean validNamespace(String ns) { return ns != null && !ns.trim().isEmpty(); }

Try / catch

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; }

Prevention

When it happens

Trigger: Calling the create-K8s-namespace API with namespace omitted, null, or an empty string.

Common situations: Front-end form submitted without the namespace field; API automation passing an empty body field; whitespace-only input trimmed to empty.

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


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/6c7d77ebbd085094. Report an issue: GitHub.