{"record":{"id":"9bda053916b52772","repo":"apache/dolphinscheduler","slug":"spark-datasource-param-is-not-valid","errorCode":null,"errorMessage":"spark datasource param is not valid","messagePattern":"spark datasource param is not valid","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-aliyunserverlessspark/src/main/java/org/apache/dolphinscheduler/plugin/datasource/aliyunserverlessspark/param/AliyunServerlessSparkDataSourceProcessor.java","lineNumber":53,"sourceCode":"\nimport com.google.auto.service.AutoService;\n\n@AutoService(DataSourceProcessor.class)\n@Slf4j\npublic class AliyunServerlessSparkDataSourceProcessor extends AbstractDataSourceProcessor {\n\n    @Override\n    public BaseDataSourceParamDTO castDatasourceParamDTO(String paramJson) {\n        return JSONUtils.parseObject(paramJson, AliyunServerlessSparkDataSourceParamDTO.class);\n    }\n\n    @Override\n    public void checkDatasourceParam(BaseDataSourceParamDTO datasourceParamDTO) {\n        AliyunServerlessSparkDataSourceParamDTO aliyunServerlessSparkDataSourceParamDTO =\n                (AliyunServerlessSparkDataSourceParamDTO) datasourceParamDTO;\n        if (StringUtils.isEmpty(aliyunServerlessSparkDataSourceParamDTO.getRegionId()) ||\n                StringUtils.isEmpty(aliyunServerlessSparkDataSourceParamDTO.getAccessKeyId())) {\n            throw new IllegalArgumentException(\"spark datasource param is not valid\");\n        }\n    }\n\n    @Override\n    public String getDatasourceUniqueId(ConnectionParam connectionParam, DbType dbType) {\n        AliyunServerlessSparkConnectionParam baseConnectionParam =\n                (AliyunServerlessSparkConnectionParam) connectionParam;\n        return MessageFormat.format(\n                \"{0}@{1}@{2}@{3}\",\n                dbType.getName(),\n                baseConnectionParam.getRegionId(),\n                PasswordUtils.encodePassword(baseConnectionParam.getAccessKeyId()),\n                PasswordUtils.encodePassword(baseConnectionParam.getAccessKeySecret()));\n    }\n\n    @Override\n    public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) {\n        AliyunServerlessSparkConnectionParam connectionParams =","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-aliyunserverlessspark/src/main/java/org/apache/dolphinscheduler/plugin/datasource/aliyunserverlessspark/param/AliyunServerlessSparkDataSourceProcessor.java#L35-L71","documentation":"AliyunServerlessSparkDataSourceProcessor.checkDatasourceParam validates datasource form parameters. It requires both regionId and accessKeyId to be non-empty; if either is missing it throws IllegalArgumentException with the generic message 'spark datasource param is not valid'.","triggerScenarios":"Creating or updating an Aliyun Serverless Spark datasource connection with an empty regionId or accessKeyId (or with the JSON key absent from the datasource param).","commonSituations":"Leaving the region field blank in the datasource form; using an access key that was not copied/pasted correctly; migration/import of datasource configs where these fields were dropped.","solutions":["Set a valid Aliyun regionId (e.g. cn-hangzhou) in the datasource parameters.","Provide a non-empty accessKeyId (and secret key) for the Aliyun account.","Re-save the datasource via the UI/API and confirm the JSON param contains both fields before testing the connection."],"exampleFix":"// before\n{\n  \"regionId\": \"\",\n  \"accessKeyId\": \"\",\n  \"accessKeySecret\": \"***\"\n}\n// after\n{\n  \"regionId\": \"cn-hangzhou\",\n  \"accessKeyId\": \"LTAI5t...\",\n  \"accessKeySecret\": \"***\"\n}","handlingStrategy":"validation","validationCode":"AliyunServerlessSparkDataSourceParamDTO p = (AliyunServerlessSparkDataSourceParamDTO) dto;\nif (StringUtils.isEmpty(p.getRegionId()) || StringUtils.isEmpty(p.getAccessKeyId())) {\n    throw new IllegalArgumentException(\"regionId and accessKeyId are required for Aliyun Serverless Spark\");\n}","typeGuard":"boolean isValidSparkParam(AliyunServerlessSparkDataSourceParamDTO p) {\n    return p != null && StringUtils.isNotEmpty(p.getRegionId()) && StringUtils.isNotEmpty(p.getAccessKeyId());\n}","tryCatchPattern":"try {\n    dataSourceService.createDataSource(dto);\n} catch (IllegalArgumentException e) {\n    log.error(\"invalid spark datasource params: {}\", e.getMessage());\n}","preventionTips":["Always fill regionId and accessKeyId in the datasource form.","Validate datasource JSON params before import/migration.","Test the connection right after creating the datasource to fail fast."],"tags":["validation","datasource","aliyun-serverless-spark"],"backgroundTag":"empty-required-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"}