{"record":{"id":"2f692db09062071d","repo":"apache/seatunnel","slug":"log-file-content-is-empty-get-log-path-s","errorCode":null,"errorMessage":"Log file content is empty, get log path : %s","messagePattern":"Log file content is empty, get log path : (.+?)","errorType":"console","errorClass":null,"httpStatus":400,"severity":"warning","filePath":"seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/servlet/LogBaseServlet.java","lineNumber":78,"sourceCode":"            String canonicalFilePath = new File(logFilePath).getCanonicalPath();\n            if (!canonicalFilePath.startsWith(canonicalLogDir + File.separator)\n                    && !canonicalFilePath.equals(canonicalLogDir)) {\n                resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);\n                log.warn(\n                        \"Path traversal attempt blocked - Requested: {}, Resolved: {}, LogDir: {}\",\n                        logName,\n                        canonicalFilePath,\n                        canonicalLogDir);\n                return;\n            }\n            String logContent = FileUtils.readFileToStr(new File(canonicalFilePath).toPath());\n            write(resp, logContent);\n        } catch (IOException e) {\n            resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);\n            log.warn(\"Failed to resolve log file path: {}, error: {}\", logFilePath, e.getMessage());\n        } catch (SeaTunnelRuntimeException e) {\n            resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);\n            log.warn(String.format(\"Log file content is empty, get log path : %s\", logFilePath));\n        }\n    }\n}\n","sourceCodeStart":60,"sourceCodeEnd":82,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/servlet/LogBaseServlet.java#L60-L82","documentation":"Logged when the servlet attempts to read a log file and a SeaTunnelRuntimeException with empty content is thrown, meaning the resolved log file exists at the path but has no readable content. The servlet responds with HTTP 400.","triggerScenarios":"Requesting a log endpoint for a log file that is empty (0 bytes) — e.g. a worker log created but nothing written yet, or a read returning empty content wrapped in SeaTunnelRuntimeException.","commonSituations":"Requesting a freshly started node's log before any output; a log rotated/truncated to zero; requesting a log file that was created on a node whose log path differs from the master's.","solutions":["Wait until the node has written output and retry the log request","Verify the correct node name — request logs from the specific worker that ran the job","Check the log file on disk directly (ls -la on the log dir) to confirm whether it is 0 bytes","Inspect the actual cause in server logs; this message hides the underlying error detail"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// give a freshly started node time to write logs before requesting\nawait new Promise(r => setTimeout(r, 5000));","typeGuard":null,"tryCatchPattern":"try {\n  const resp = await fetch(baseUrl + '/log/' + node);\n  if (resp.status === 400) {\n    const body = await resp.text();\n    if (body.includes('empty')) { /* retry later or read file on disk */ }\n  }\n} catch (e) { /* handle network errors */ }","preventionTips":["Don't request logs immediately after node startup; add a small delay","Verify the node actually produced output before fetching its log","Check log rotation settings to avoid zero-byte truncated files","When persistent, read the file directly on the host to compare with the REST result"],"tags":["logging","rest-api","empty-file"],"backgroundTag":"file-read-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}