apache/dolphinscheduler · error · TaskException
linkis task id is null
Error message
linkis task id is null
What it means
LinkisTask.initTaskId() resolves the Linkis job id from the cached taskId field or getAppIds(). If both are null it throws TaskException('linkis task id is null') because status tracking and cancellation require the job id.
Source
Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-linkis/src/main/java/org/apache/dolphinscheduler/plugin/task/linkis/LinkisTask.java:203
log.info("raw param config content : {}", linkisParameters.getParamScript());
String script = "";
List<LinkisParameters.Param> paramList = linkisParameters.getParamScript();
for (LinkisParameters.Param param : paramList) {
script = script.concat(param.getProps())
.concat(Constants.SPACE)
.concat(param.getValue());
}
return script;
}
private void initTaskId() {
if (taskId == null) {
if (StringUtils.isNotEmpty(getAppIds())) {
taskId = getAppIds();
}
}
if (taskId == null) {
throw new TaskException("linkis task id is null");
}
}
protected String findTaskId(String line) {
Matcher matcher = LINKIS_TASK_ID_REGEX.matcher(line);
if (matcher.find()) {
String str = matcher.group();
return str.substring(11);
}
return null;
}
protected String findStatus(String line) {
Matcher matcher = LINKIS_STATUS_REGEX.matcher(line);
if (matcher.find()) {
String str = matcher.group();
return str.substring(11);
}View on GitHub (pinned to 02eac45a1b)
Solutions
- Ensure submitApplication() completed successfully and the Linkis output contained the task id.
- Check that LINKIS_TASK_ID_REGEX still matches your Linkis CLI output format.
- If the job exists, recover the appId (task instance records) or kill it from the Linkis console.
- Rerun the workflow so a fresh submission produces a new id.
Defensive patterns
Strategy: validation
Validate before calling
if (task.getAppIds() == null || task.getAppIds().isEmpty()) {
throw new IllegalStateException("Cannot track/cancel: Linkis job has no appId (was it submitted?)");
} Try / catch
try {
task.cancelApplication();
} catch (TaskException e) {
if (e.getMessage().contains("linkis task id is null")) {
// kill from Linkis console instead
}
} Prevention
- Only track/cancel tasks after successful submitApplication().
- Verify the task-id regex captures output on your Linkis version.
- Persist appIds so state survives worker restarts.
When it happens
Trigger: trackApplicationStatus() or cancelApplication() runs before the job id was captured: submitApplication never ran or failed, the id regex never matched the output, and getAppIds() returned empty.
Common situations: Killing a task whose submission never wrote an appId; submit failed earlier; log parsing missed the id line; worker restart lost in-memory state.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- cancel linkis task error
- 130020
- 50008
- Invalid State value: + value
- Jdbc lock count has gone negative for lock:
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/c071795444ab8582.
Report an issue: GitHub.