apache/dolphinscheduler · error · RuntimeException
sqoop task source type or target type is null
Error message
sqoop task source type or target type is null
What it means
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.
Source
Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/SqoopJobGenerator.java:85
targetGenerator = createTargetGenerator(targetType);
}
/**
* get the final sqoop scripts
*
* @param sqoopParameters sqoop params
* @param sqoopTaskExecutionContext
* @return sqoop scripts
*/
public String generateSqoopJob(SqoopParameters sqoopParameters,
SqoopTaskExecutionContext sqoopTaskExecutionContext) {
String sqoopScripts = "";
if (SqoopJobType.TEMPLATE.getDescp().equals(sqoopParameters.getJobType())) {
createSqoopJobGenerator(sqoopParameters.getSourceType(), sqoopParameters.getTargetType());
if (sourceGenerator == null || targetGenerator == null) {
throw new RuntimeException("sqoop task source type or target type is null");
}
sqoopScripts = String.format("%s%s%s", commonGenerator.generate(sqoopParameters),
sourceGenerator.generate(sqoopParameters, sqoopTaskExecutionContext),
targetGenerator.generate(sqoopParameters, sqoopTaskExecutionContext));
} else if (SqoopJobType.CUSTOM.getDescp().equals(sqoopParameters.getJobType())) {
sqoopScripts = sqoopParameters.getCustomShell().replaceAll("\\r\\n", System.lineSeparator());
}
return sqoopScripts;
}
/**
* get the source generator
*
* @param sourceType sqoop source type
* @return sqoop source generator
*/View on GitHub (pinned to 02eac45a1b)
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
Example fix
// before
{"jobType":"TEMPLATE","sourceType":"mysql","targetType":null}
// after
{"jobType":"TEMPLATE","sourceType":"MYSQL","targetType":"HDFS"} Defensive patterns
Strategy: validation
Validate before calling
java.util.Set<String> valid = java.util.Set.of("MYSQL","HIVE","HDFS","KAFKA","SPARK","HBASE","FTP","CLICKHOUSE","ORACLE","POSTGRESQL","SQLSERVER","CARBONDATA");
if (!"CUSTOM".equals(params.getJobType())) {
if (!valid.contains(params.getSourceType()) || !valid.contains(params.getTargetType())) {
throw new IllegalStateException("Unknown sqoop source/target type");
}
} Try / catch
try {
String script = sqoopGenerator.getScript();
} catch (RuntimeException e) {
if (e.getMessage().contains("source type or target type is null")) {
// fix sourceType/targetType in task params
}
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- requestType is not a valid value
- contentType is not a valid value
- The execType: {execType} is invalid
- The releaseState {releaseState} is illegal, please check it.
- The task execution status code: %s is invalid
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/cc83b336c5a3d35b.
Report an issue: GitHub.