{"record":{"id":"73fa505a3872c6ee","repo":"apache/dolphinscheduler","slug":"sagemaker-datasource-param-is-not-valid","errorCode":null,"errorMessage":"sagemaker datasource param is not valid","messagePattern":"sagemaker datasource param is not valid","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-k8s/src/main/java/org/apache/dolphinscheduler/plugin/datasource/k8s/param/K8sDataSourceProcessor.java","lineNumber":52,"sourceCode":"import lombok.extern.slf4j.Slf4j;\n\nimport com.google.auto.service.AutoService;\n\n@AutoService(DataSourceProcessor.class)\n@Slf4j\npublic class K8sDataSourceProcessor extends AbstractDataSourceProcessor {\n\n    @Override\n    public BaseDataSourceParamDTO castDatasourceParamDTO(String paramJson) {\n        return JSONUtils.parseObject(paramJson, K8sDataSourceParamDTO.class);\n\n    }\n\n    @Override\n    public void checkDatasourceParam(BaseDataSourceParamDTO datasourceParam) {\n        K8sDataSourceParamDTO k8sDataSourceParamDTO = (K8sDataSourceParamDTO) datasourceParam;\n        if (StringUtils.isEmpty(k8sDataSourceParamDTO.getKubeConfig())) {\n            throw new IllegalArgumentException(\"sagemaker datasource param is not valid\");\n        }\n    }\n\n    @Override\n    public String getDatasourceUniqueId(ConnectionParam connectionParam, DbType dbType) {\n        K8sConnectionParam baseConnectionParam = (K8sConnectionParam) connectionParam;\n        return MessageFormat.format(\"{0}@{1}@{2}\", dbType.getName(),\n                PasswordUtils.encodePassword(baseConnectionParam.getKubeConfig()), baseConnectionParam.getNamespace());\n    }\n\n    @Override\n    public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) {\n        K8sConnectionParam connectionParams = (K8sConnectionParam) createConnectionParams(connectionJson);\n        K8sDataSourceParamDTO k8sDataSourceParamDTO = new K8sDataSourceParamDTO();\n        k8sDataSourceParamDTO.setKubeConfig(connectionParams.getKubeConfig());\n        k8sDataSourceParamDTO.setNamespace(connectionParams.getNamespace());\n        return k8sDataSourceParamDTO;\n    }","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-k8s/src/main/java/org/apache/dolphinscheduler/plugin/datasource/k8s/param/K8sDataSourceProcessor.java#L34-L70","documentation":"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.","triggerScenarios":"Creating/updating a K8s-type datasource whose kubeConfig field is empty or whitespace-only; the processor casts the param DTO and rejects before persistence.","commonSituations":"Saving a K8s datasource without pasting the kubeconfig YAML; UI field left blank; copying a datasource definition programmatically and omitting kubeConfig.","solutions":["Provide a valid kubeConfig content in the K8s datasource form (paste the ~/.kube/config YAML)","Verify the API request body includes kubeConfig (JSON field name) when creating the datasource programmatically","If this is your fork, fix the copy-paste error message to reference k8s/kubeConfig"],"exampleFix":"// before\nPOST /datasources {\"type\":\"K8S\",\"name\":\"myk8s\"}            // no kubeConfig -> error\n// after\nPOST /datasources {\"type\":\"K8S\",\"name\":\"myk8s\",\"kubeConfig\":\"apiVersion: v1\\nclusters: ...\"}","handlingStrategy":"validation","validationCode":"if (k8sParam.getKubeConfig() == null || k8sParam.getKubeConfig().trim().isEmpty()) {\n  throw new IllegalArgumentException(\"kubeConfig is required for K8s datasource\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  processor.checkDatasourceParam(dto);\n} catch (IllegalArgumentException e) {\n  ui.showError(\"K8s datasource requires a non-empty kubeConfig\");\n}","preventionTips":["Require kubeConfig in the datasource creation form/UI before submit","Validate API payloads for kubeConfig when automating datasource creation","Ignore the misleading 'sagemaker' wording — it means kubeConfig is missing"],"tags":["k8s","validation","missing-config","kubeconfig"],"backgroundTag":"missing-required-config-field","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"}