apache/dolphinscheduler · error · TaskException
cancel paragraph error
Error message
cancel paragraph error
What it means
ZeppelinTask.cancelApplication wraps any exception from zClient.cancelParagraph(noteId, paragraphId) into a TaskException with the message 'cancel paragraph error'. It means the attempt to terminate a running Zeppelin paragraph via the Zeppelin client API failed. The underlying cause (network problem, invalid note/paragraph id, Zeppelin server down) is attached as the cause.
Source
Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-zeppelin/src/main/java/org/apache/dolphinscheduler/plugin/task/zeppelin/ZeppelinTask.java:246
@Override
public void cancelApplication() throws TaskException {
final String restEndpoint = this.zeppelinParameters.getRestEndpoint();
final String noteId = this.zeppelinParameters.getNoteId();
final String paragraphId = this.zeppelinParameters.getParagraphId();
if (paragraphId == null) {
log.info("trying terminate zeppelin task, taskId: {}, noteId: {}",
this.taskExecutionContext.getTaskInstanceId(), noteId);
Unirest.config().defaultBaseUrl(restEndpoint + "/api");
Unirest.delete("/notebook/job/{noteId}").routeParam("noteId", noteId).asJson();
log.info("zeppelin task terminated, taskId: {}, noteId: {}", this.taskExecutionContext.getTaskInstanceId(),
noteId);
} else {
log.info("trying terminate zeppelin task, taskId: {}, noteId: {}, paragraphId: {}",
this.taskExecutionContext.getTaskInstanceId(), noteId, paragraphId);
try {
this.zClient.cancelParagraph(noteId, paragraphId);
} catch (Exception e) {
throw new TaskException("cancel paragraph error", e);
}
log.info("zeppelin task terminated, taskId: {}, noteId: {}, paragraphId: {}",
this.taskExecutionContext.getTaskInstanceId(), noteId, paragraphId);
}
}
@Override
public List<String> getApplicationIds() throws TaskException {
return Collections.emptyList();
}
public void addDefaultOutput(String response) {
// put response in output
Property outputProperty = new Property();
outputProperty.setProp(String.format("%s.%s", taskExecutionContext.getTaskName(), "result"));
outputProperty.setDirect(Direct.OUT);
outputProperty.setType(DataType.VARCHAR);View on GitHub (pinned to 02eac45a1b)
Solutions
- Verify the Zeppelin server URL and credentials in the task/plugin configuration are correct and the server is reachable (curl the REST endpoint).
- Check the wrapped cause in the TaskException stack trace for the real Zeppelin client error.
- Confirm noteId and paragraphId were captured from the task output correctly; re-run the task to get fresh IDs if the paragraph already finished.
- Retry the cancel; if the paragraph already completed, treat the task as finished instead of failed.
Example fix
// before
try {
this.zClient.cancelParagraph(noteId, paragraphId);
} catch (Exception e) {
throw new TaskException("cancel paragraph error", e);
}
// after
try {
this.zClient.cancelParagraph(noteId, paragraphId);
} catch (Exception e) {
log.warn("Cancel paragraph failed, noteId: {}, paragraphId: {}", noteId, paragraphId, e);
throw new TaskException("cancel paragraph error, noteId: " + noteId + ", paragraphId: " + paragraphId, e);
} Defensive patterns
Strategy: try-catch
Validate before calling
// before cancelling, verify the paragraph is still running
String status = zeppelinClient.getParagraphStatus(noteId, paragraphId);
if (!"RUNNING".equals(status)) { log.info("paragraph {} already finished", paragraphId); return; }
// and verify the server is reachable
// new java.net.URL(zeppelinUrl).openConnection().connect(); Try / catch
try {
task.cancel();
} catch (TaskException e) {
log.error("Zeppelin cancel failed: {}", e.getCause() != null ? e.getCause().getMessage() : e.getMessage(), e);
// decide whether to rethrow based on whether the task is still running
} Prevention
- Health-check the Zeppelin server before submitting tasks.
- Persist noteId/paragraphId from task output and reuse them for cancel.
- Treat 'paragraph already completed' cancels as success, not failure.
- Set reasonable Zeppelin client timeouts.
When it happens
Trigger: Calling cancelApplication (task kill/cancel from DolphinScheduler) when the Zeppelin client throws while cancelling the paragraph: Zeppelin server unreachable, noteId/paragraphId invalid or already finished, or an authentication/session error in ZeppelinClient.
Common situations: Killing a running Zeppelin task whose Zeppelin server has been restarted or is down; stale paragraphId from a prior run; Zeppelin returning an error for an already-completed paragraph; network/firewall issues between the worker and Zeppelin.
Understand the failure class
Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.
Related errors
- WorkflowInstance: %s pause failed
- WorkflowInstance: %s stop failed
- OIDC_TOKEN_EXCHANGE_FAILED
- 110014
- 1300006
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/5ac21823c25f2bba.
Report an issue: GitHub.