{"record":{"id":"cc83b336c5a3d35b","repo":"apache/dolphinscheduler","slug":"sqoop-task-source-type-or-target-type-is-null","errorCode":null,"errorMessage":"sqoop task source type or target type is null","messagePattern":"sqoop task source type or target type is null","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/SqoopJobGenerator.java","lineNumber":85,"sourceCode":"        targetGenerator = createTargetGenerator(targetType);\n    }\n\n    /**\n     * get the final sqoop scripts\n     *\n     * @param sqoopParameters           sqoop params\n     * @param sqoopTaskExecutionContext\n     * @return sqoop scripts\n     */\n    public String generateSqoopJob(SqoopParameters sqoopParameters,\n                                   SqoopTaskExecutionContext sqoopTaskExecutionContext) {\n\n        String sqoopScripts = \"\";\n\n        if (SqoopJobType.TEMPLATE.getDescp().equals(sqoopParameters.getJobType())) {\n            createSqoopJobGenerator(sqoopParameters.getSourceType(), sqoopParameters.getTargetType());\n            if (sourceGenerator == null || targetGenerator == null) {\n                throw new RuntimeException(\"sqoop task source type or target type is null\");\n            }\n\n            sqoopScripts = String.format(\"%s%s%s\", commonGenerator.generate(sqoopParameters),\n                    sourceGenerator.generate(sqoopParameters, sqoopTaskExecutionContext),\n                    targetGenerator.generate(sqoopParameters, sqoopTaskExecutionContext));\n        } else if (SqoopJobType.CUSTOM.getDescp().equals(sqoopParameters.getJobType())) {\n            sqoopScripts = sqoopParameters.getCustomShell().replaceAll(\"\\\\r\\\\n\", System.lineSeparator());\n        }\n\n        return sqoopScripts;\n    }\n\n    /**\n     * get the source generator\n     *\n     * @param sourceType sqoop source type\n     * @return sqoop source generator\n     */","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/SqoopJobGenerator.java#L67-L103","documentation":"SqoopJobGenerator.generateSqoopJob builds the sqoop command for TEMPLATE job type by locating a source generator and a target generator for the configured types. If createSqoopJobGenerator cannot find a generator (unknown or missing sourceType/targetType), it throws this RuntimeException.","triggerScenarios":"Job type is TEMPLATE but sqoopParameters.getSourceType() or getTargetType() is null or a string that matches no registered generator (e.g. typo, lowercase, unsupported type).","commonSituations":"Workflow JSON hand-edited with a null/unknown sourceType or targetType; upgrading DS where a generator name changed; copying a template and forgetting to set the types.","solutions":["Set valid sourceType and targetType values (e.g. MYSQL, HIVE, HDFS) on the Sqoop task node in the UI","Inspect the task params JSON and ensure sourceType/targetType are non-null and spelled exactly as supported","Upgrade/align the plugin version if a previously working type is no longer registered"],"exampleFix":"// before\n{\"jobType\":\"TEMPLATE\",\"sourceType\":\"mysql\",\"targetType\":null}\n// after\n{\"jobType\":\"TEMPLATE\",\"sourceType\":\"MYSQL\",\"targetType\":\"HDFS\"}","handlingStrategy":"validation","validationCode":"java.util.Set<String> valid = java.util.Set.of(\"MYSQL\",\"HIVE\",\"HDFS\",\"KAFKA\",\"SPARK\",\"HBASE\",\"FTP\",\"CLICKHOUSE\",\"ORACLE\",\"POSTGRESQL\",\"SQLSERVER\",\"CARBONDATA\");\nif (!\"CUSTOM\".equals(params.getJobType())) {\n    if (!valid.contains(params.getSourceType()) || !valid.contains(params.getTargetType())) {\n        throw new IllegalStateException(\"Unknown sqoop source/target type\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    String script = sqoopGenerator.getScript();\n} catch (RuntimeException e) {\n    if (e.getMessage().contains(\"source type or target type is null\")) {\n        // fix sourceType/targetType in task params\n    }\n}","preventionTips":["Use exact supported type strings (uppercase, as in SqoopSourceTargetType)","Never leave sourceType/targetType null for TEMPLATE job type","Prefer the UI form over hand-editing workflow JSON"],"tags":["sqoop","enum","generator"],"backgroundTag":"invalid-enum-value","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"}