apache/dolphinscheduler · error · ServiceException

DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR

DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR

Error message

DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR

What it means

Thrown by LoggerServiceImpl.getLogBytes when fetching the whole log file bytes from the worker fails. Like the queryLog wrapper, it masks the underlying cause (logged via log.error) and surfaces the DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR status.

Source

Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/LoggerServiceImpl.java:233

     * @return log byte array
     */
    private byte[] getLogBytes(TaskInstance taskInstance) {
        String host = taskInstance.getHost();
        String logPath = taskInstance.getLogPath();

        byte[] head = String.format(LOG_HEAD_FORMAT,
                logPath,
                host,
                Constants.SYSTEM_LINE_SEPARATOR).getBytes(StandardCharsets.UTF_8);

        byte[] logBytes;

        try {
            logBytes = logClientDelegate.getWholeLogBytes(taskInstance);
            return Bytes.concat(head, logBytes);
        } catch (Exception ex) {
            log.error("Download TaskInstance: {} Log Error", taskInstance.getName(), ex);
            throw new ServiceException(Status.DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR);
        }
    }
}

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Check API server logs for 'Download TaskInstance: {} Log Error' to see the underlying exception.
  2. Verify task.host worker is up and the log file exists at task.logPath.
  3. Confirm network/firewall allows the API server to reach the worker's log port.
  4. If logs were cleaned up, restore from backup or re-run the task to regenerate logs.

Example fix

// before
byte[] bytes = loggerService.getLogBytes(loginUser, projectCode, taskInstId);
// after
try {
    byte[] bytes = loggerService.getLogBytes(loginUser, projectCode, taskInstId);
} catch (ServiceException e) {
    // DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR - check worker connectivity/log file
}
Defensive patterns

Strategy: try-catch

Validate before calling

TaskInstance task = taskInstanceDao.queryById(taskInstId);
boolean reachable = task != null && InetAddress.getByName(task.getHost()).isReachable(3000);

Try / catch

try {
    byte[] bytes = loggerService.getLogBytes(loginUser, projectCode, taskInstId);
} catch (ServiceException e) {
    // DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR - check worker/file, fallback to queryLog
}

Prevention

When it happens

Trigger: Any exception in logClientDelegate.getWholeLogBytes(taskInstance): worker unreachable, RPC failure, log file missing on the worker, IO error reading the file.

Common situations: Worker host decommissioned between task run and download attempt; log retention cleanup removed the file; firewall blocking the log port; oversized log file causing timeouts/OOM on transfer.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/2a61af0544b16930. Report an issue: GitHub.