{"record":{"id":"acc65c42b0f6757f","repo":"apache/dolphinscheduler","slug":"kubeflow-task-params-is-not-valid","errorCode":null,"errorMessage":"Kubeflow task params is not valid","messagePattern":"Kubeflow task params is not valid","errorType":"validation","errorClass":"TaskException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-kubeflow/src/main/java/org/apache/dolphinscheduler/plugin/kubeflow/KubeflowTask.java","lineNumber":63,"sourceCode":"    protected KubeflowHelper kubeflowHelper;\n    private KubeflowParameters kubeflowParameters;\n    private Path clusterYAMLPath;\n\n    private Path yamlPath;\n\n    public KubeflowTask(TaskExecutionContext taskExecutionContext) {\n        super(taskExecutionContext);\n        this.taskExecutionContext = taskExecutionContext;\n    }\n\n    @Override\n    public void init() throws TaskException {\n        kubeflowParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), KubeflowParameters.class);\n        log.info(\"Initialize Kubeflow task params {}\", taskExecutionContext.getTaskParams());\n\n        kubeflowParameters.setClusterYAML(taskExecutionContext.getK8sTaskExecutionContext().getConfigYaml());\n        if (!kubeflowParameters.checkParameters()) {\n            throw new TaskException(\"Kubeflow task params is not valid\");\n        }\n\n        writeFiles();\n        kubeflowHelper = new KubeflowHelper(clusterYAMLPath.toString());\n    }\n\n    @Override\n    public void submitApplication() throws TaskException {\n        String command = kubeflowHelper.buildSubmitCommand(yamlPath.toString());\n        log.info(\"Kubeflow task submit command: \\n{}\", command);\n        String message = runCommand(command);\n        log.info(\"Kubeflow task submit result: \\n{}\", message);\n\n        KubeflowHelper.ApplicationIds applicationIds = new KubeflowHelper.ApplicationIds();\n        applicationIds.setAlreadySubmitted(true);\n        setAppIds(JSONUtils.toJsonString(applicationIds));\n    }\n","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-kubeflow/src/main/java/org/apache/dolphinscheduler/plugin/kubeflow/KubeflowTask.java#L45-L81","documentation":"KubeflowTask.init() parses taskParams into KubeflowParameters, injects the cluster YAML from the K8s task execution context, and throws TaskException 'Kubeflow task params is not valid' when kubeflowParameters.checkParameters() fails. Note it also dereferences getK8sTaskExecutionContext() unguarded, so a null K8s context would NPE before this message.","triggerScenarios":"init() runs and kubeflowParameters.checkParameters() returns false — required kubeflow params (e.g. the resource YAML content/name/namespace) are missing or empty; alternatively getK8sTaskExecutionContext() is null so setClusterYAML throws NPE inside init.","commonSituations":"Kubeflow task saved without the YAML definition or required fields, the cluster's K8s execution context (configYaml) missing because the task is not attached to a K8s cluster configured in the environment, or params JSON from an older version lacking new required fields.","solutions":["Check taskParams JSON against KubeflowParameters.checkParameters() rules and fill the missing fields in the UI.","Ensure the task is bound to a properly configured K8s cluster so getK8sTaskExecutionContext().getConfigYaml() is populated.","Re-save the task node to regenerate params in the current schema.","Inspect worker logs for a NullPointerException at init to distinguish schema issues from missing cluster context."],"exampleFix":"// before\n{\"name\":\"my-pipeline\"}\n// after\n{\"name\":\"my-pipeline\",\"namespace\":\"kubeflow\",\"resourceYaml\":\"apiVersion: ...\"}","handlingStrategy":"validation","validationCode":"KubeflowParameters p = JSONUtils.parseObject(taskParamsJson, KubeflowParameters.class);\nif (p == null || !p.checkParameters())\n    throw new IllegalArgumentException(\"invalid kubeflow params: \" + taskParamsJson);\n// also ensure cluster context is attached\nif (k8sTaskExecutionContext == null || k8sTaskExecutionContext.getConfigYaml() == null)\n    throw new IllegalStateException(\"task is not bound to a K8s cluster context\");","typeGuard":"static boolean kubeflowParamsReady(String taskParamsJson, K8sTaskExecutionContext ctx) {\n    KubeflowParameters p = JSONUtils.parseObject(taskParamsJson, KubeflowParameters.class);\n    return p != null && p.checkParameters()\n        && ctx != null && ctx.getConfigYaml() != null;\n}","tryCatchPattern":"try {\n    kubeflowTask.init();\n} catch (TaskException e) {\n    if (e.getMessage().contains(\"params is not valid\")) {\n        log.error(\"kubeflow params missing required fields; fix task definition\", e);\n    }\n    throw e;\n} catch (NullPointerException e) {\n    log.error(\"K8s task execution context missing - bind task to a configured cluster\", e);\n}","preventionTips":["Provide the resource YAML and required fields in the kubeflow task definition.","Attach the task to an environment whose K8s cluster config is populated.","Re-save nodes after upgrading to regenerate params in the current schema.","Validate params and cluster context in CI before deploying workflows."],"tags":["kubeflow","parameter-validation","k8s","task-config"],"backgroundTag":"schema-validation-failed","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"}