apache/dolphinscheduler · error · IllegalArgumentException

sagemaker datasource param is not valid

Error message

sagemaker datasource param is not valid

What it means

K8sDataSourceProcessor.checkDatasourceParam validates that the K8s datasource supplies a non-empty kubeConfig; if empty it throws IllegalArgumentException. The message misleadingly mentions 'sagemaker' — a leftover copy-paste from the sagemaker processor — but the check is about the missing kubeConfig field.

Source

Thrown at dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-k8s/src/main/java/org/apache/dolphinscheduler/plugin/datasource/k8s/param/K8sDataSourceProcessor.java:52

import lombok.extern.slf4j.Slf4j;

import com.google.auto.service.AutoService;

@AutoService(DataSourceProcessor.class)
@Slf4j
public class K8sDataSourceProcessor extends AbstractDataSourceProcessor {

    @Override
    public BaseDataSourceParamDTO castDatasourceParamDTO(String paramJson) {
        return JSONUtils.parseObject(paramJson, K8sDataSourceParamDTO.class);

    }

    @Override
    public void checkDatasourceParam(BaseDataSourceParamDTO datasourceParam) {
        K8sDataSourceParamDTO k8sDataSourceParamDTO = (K8sDataSourceParamDTO) datasourceParam;
        if (StringUtils.isEmpty(k8sDataSourceParamDTO.getKubeConfig())) {
            throw new IllegalArgumentException("sagemaker datasource param is not valid");
        }
    }

    @Override
    public String getDatasourceUniqueId(ConnectionParam connectionParam, DbType dbType) {
        K8sConnectionParam baseConnectionParam = (K8sConnectionParam) connectionParam;
        return MessageFormat.format("{0}@{1}@{2}", dbType.getName(),
                PasswordUtils.encodePassword(baseConnectionParam.getKubeConfig()), baseConnectionParam.getNamespace());
    }

    @Override
    public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) {
        K8sConnectionParam connectionParams = (K8sConnectionParam) createConnectionParams(connectionJson);
        K8sDataSourceParamDTO k8sDataSourceParamDTO = new K8sDataSourceParamDTO();
        k8sDataSourceParamDTO.setKubeConfig(connectionParams.getKubeConfig());
        k8sDataSourceParamDTO.setNamespace(connectionParams.getNamespace());
        return k8sDataSourceParamDTO;
    }

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Provide a valid kubeConfig content in the K8s datasource form (paste the ~/.kube/config YAML)
  2. Verify the API request body includes kubeConfig (JSON field name) when creating the datasource programmatically
  3. If this is your fork, fix the copy-paste error message to reference k8s/kubeConfig

Example fix

// before
POST /datasources {"type":"K8S","name":"myk8s"}            // no kubeConfig -> error
// after
POST /datasources {"type":"K8S","name":"myk8s","kubeConfig":"apiVersion: v1\nclusters: ..."}
Defensive patterns

Strategy: validation

Validate before calling

if (k8sParam.getKubeConfig() == null || k8sParam.getKubeConfig().trim().isEmpty()) {
  throw new IllegalArgumentException("kubeConfig is required for K8s datasource");
}

Try / catch

try {
  processor.checkDatasourceParam(dto);
} catch (IllegalArgumentException e) {
  ui.showError("K8s datasource requires a non-empty kubeConfig");
}

Prevention

When it happens

Trigger: Creating/updating a K8s-type datasource whose kubeConfig field is empty or whitespace-only; the processor casts the param DTO and rejects before persistence.

Common situations: Saving a K8s datasource without pasting the kubeconfig YAML; UI field left blank; copying a datasource definition programmatically and omitting kubeConfig.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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