{"record":{"id":"2a61af0544b16930","repo":"apache/dolphinscheduler","slug":"download-task-instance-log-file-error","errorCode":"DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR","errorMessage":"DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR","messagePattern":"DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/LoggerServiceImpl.java","lineNumber":233,"sourceCode":"     * @return log byte array\n     */\n    private byte[] getLogBytes(TaskInstance taskInstance) {\n        String host = taskInstance.getHost();\n        String logPath = taskInstance.getLogPath();\n\n        byte[] head = String.format(LOG_HEAD_FORMAT,\n                logPath,\n                host,\n                Constants.SYSTEM_LINE_SEPARATOR).getBytes(StandardCharsets.UTF_8);\n\n        byte[] logBytes;\n\n        try {\n            logBytes = logClientDelegate.getWholeLogBytes(taskInstance);\n            return Bytes.concat(head, logBytes);\n        } catch (Exception ex) {\n            log.error(\"Download TaskInstance: {} Log Error\", taskInstance.getName(), ex);\n            throw new ServiceException(Status.DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR);\n        }\n    }\n}\n","sourceCodeStart":215,"sourceCodeEnd":237,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/LoggerServiceImpl.java#L215-L237","documentation":"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.","triggerScenarios":"Any exception in logClientDelegate.getWholeLogBytes(taskInstance): worker unreachable, RPC failure, log file missing on the worker, IO error reading the file.","commonSituations":"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.","solutions":["Check API server logs for 'Download TaskInstance: {} Log Error' to see the underlying exception.","Verify task.host worker is up and the log file exists at task.logPath.","Confirm network/firewall allows the API server to reach the worker's log port.","If logs were cleaned up, restore from backup or re-run the task to regenerate logs."],"exampleFix":"// before\nbyte[] bytes = loggerService.getLogBytes(loginUser, projectCode, taskInstId);\n// after\ntry {\n    byte[] bytes = loggerService.getLogBytes(loginUser, projectCode, taskInstId);\n} catch (ServiceException e) {\n    // DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR - check worker connectivity/log file\n}","handlingStrategy":"try-catch","validationCode":"TaskInstance task = taskInstanceDao.queryById(taskInstId);\nboolean reachable = task != null && InetAddress.getByName(task.getHost()).isReachable(3000);","typeGuard":null,"tryCatchPattern":"try {\n    byte[] bytes = loggerService.getLogBytes(loginUser, projectCode, taskInstId);\n} catch (ServiceException e) {\n    // DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR - check worker/file, fallback to queryLog\n}","preventionTips":["Verify worker host reachability before bulk log downloads.","Ensure log cleanup policies do not delete files still being downloaded.","Watch API server logs for the wrapped root exception."],"tags":["dolphinscheduler","log-download","rpc"],"backgroundTag":"file-read-failed","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"}