{"record":{"id":"38cbe729958ec458","repo":"apache/dolphinscheduler","slug":"emr-serverless-task-params-are-not-valid","errorCode":null,"errorMessage":"EMR Serverless task params are not valid","messagePattern":"EMR Serverless task params are not valid","errorType":"validation","errorClass":"EmrServerlessTaskException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-emr-serverless/src/main/java/org/apache/dolphinscheduler/plugin/task/emrserverless/EmrServerlessTask.java","lineNumber":121,"sourceCode":"\n    /**\n     * jobRunId returned by StartJobRun or recovered from appIds\n     */\n    private String jobRunId;\n\n    protected EmrServerlessTask(TaskExecutionContext taskExecutionContext) {\n        super(taskExecutionContext);\n        this.taskExecutionContext = taskExecutionContext;\n    }\n\n    @Override\n    public void init() {\n        final String taskParams = taskExecutionContext.getTaskParams();\n        emrServerlessParameters = JSONUtils.parseObject(taskParams, EmrServerlessParameters.class);\n        log.info(\"Initialize EMR Serverless task params: {}\", JSONUtils.toPrettyJsonString(taskParams));\n\n        if (emrServerlessParameters == null || !emrServerlessParameters.checkParameters()) {\n            throw new EmrServerlessTaskException(\"EMR Serverless task params are not valid\");\n        }\n\n        emrServerlessClient = createEmrServerlessClient();\n    }\n\n    @Override\n    public void submitApplication() throws TaskException {\n        try {\n            StartJobRunRequest request = buildStartJobRunRequest();\n\n            log.info(\"Submitting EMR Serverless job run to application: {}\",\n                    emrServerlessParameters.getApplicationId());\n            StartJobRunResult result = emrServerlessClient.startJobRun(request);\n\n            jobRunId = result.getJobRunId();\n            // Store jobRunId for failover recovery; applicationId is always available from parameters\n            setAppIds(jobRunId);\n            log.info(\"Successfully submitted EMR Serverless job run, jobRunId: {}\", jobRunId);","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-emr-serverless/src/main/java/org/apache/dolphinscheduler/plugin/task/emrserverless/EmrServerlessTask.java#L103-L139","documentation":"EmrServerlessTask.init parses taskExecutionContext.getTaskParams() into EmrServerlessParameters and validates them. If the JSON is unparseable (null result) or EmrServerlessParameters.checkParameters() fails (required fields missing, e.g. jobRunId vs applicationId for the chosen operation), it throws EmrServerlessTaskException 'EMR Serverless task params are not valid'.","triggerScenarios":"init() runs for every EMR Serverless task start; throws when taskParams JSON is empty/malformed or checkParameters() finds missing required fields such as emrServerlessType, applicationId, or (for job runs) jobRunId/releaseLabel/executionRoleArn/jobDriver.","commonSituations":"EMR Serverless node saved with incomplete form; switching operation type (start application vs run job) without filling the newly required fields; older workflow JSON incompatible after plugin parameter changes; typo in JSON field casing.","solutions":["Open the EMR Serverless task node and complete all required fields per the selected operation type (applicationId, and jobRun fields for job runs).","Read EmrServerlessParameters.checkParameters() to see the exact required-field rules and satisfy them.","Validate the stored taskParams JSON parses and matches current EmrServerlessParameters schema (camelCase field names).","If upgrading DolphinScheduler, re-save old EMR Serverless nodes so parameter JSON matches the new schema."],"exampleFix":"// before: job run missing jobRunId\n{\"emrServerlessType\":\"JOB_RUN\",\"applicationId\":\"00f...\",\"localParams\":[]}\n// after\n{\"emrServerlessType\":\"JOB_RUN\",\"applicationId\":\"00f...\",\"jobRunId\":\"jr-...\",\"releaseLabel\":\"emr-6.9.0\",\"jobDriver\":{...},\"executionRoleArn\":\"arn:aws:iam::...:role/EMRServerlessRole\",\"localParams\":[]}","handlingStrategy":"validation","validationCode":"EmrServerlessParameters p = JSONUtils.parseObject(taskParams, EmrServerlessParameters.class);\nif (p == null || !p.checkParameters()) {\n    throw new IllegalArgumentException(\"EMR Serverless params invalid: required fields missing for operation \" + p.getEmrServerlessType());\n}","typeGuard":"boolean emrServerlessParamsValid(String json) {\n    EmrServerlessParameters p = JSONUtils.parseObject(json, EmrServerlessParameters.class);\n    return p != null && p.checkParameters();\n}","tryCatchPattern":"try {\n    emrServerlessTask.init();\n} catch (EmrServerlessTaskException e) {\n    // prompt user to complete the EMR Serverless node form fields\n}","preventionTips":["Complete all node-form fields for the selected operation type before saving.","Check checkParameters() rules when constructing taskParams programmatically.","Use camelCase field names matching EmrServerlessParameters.","Re-save old nodes after plugin upgrades so JSON matches the current schema."],"tags":["emr-serverless","aws","task-params","validation","config"],"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-14T05:17:10.506Z"}