{"record":{"id":"024b4c7734259518","repo":"kestra-io/kestra","slug":"unable-to-fetch-error-logs","errorCode":null,"errorMessage":"Unable to fetch error logs","messagePattern":"Unable to fetch error logs","errorType":"exception","errorClass":"PebbleException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/runners/pebble/functions/ErrorLogsFunction.java","lineNumber":66,"sourceCode":"        Map<String, String> flow = (Map<String, String>) context.getVariable(\"flow\");\n        Map<String, String> execution = (Map<String, String>) context.getVariable(\"execution\");\n\n        RetryUtils.Instance<List<LogEntry>, Throwable> retry = RetryUtils.of(\n            Exponential.builder()\n                .delayFactor(2.0)\n                .interval(Duration.ofMillis(100))\n                .maxInterval(Duration.ofSeconds(1))\n                .maxAttempts(-1)\n                .maxDuration(Duration.ofSeconds(5))\n                .build()\n        );\n\n        try {\n            return retry.run(logs -> ListUtils.isEmpty(logs), () -> executionLogMetaStore.get().errorLogs(flow.get(\"tenantId\"), execution.get(\"id\")));\n        } catch (RetryUtils.RetryFailed e) {\n            return Collections.emptyList();\n        } catch (Throwable e) {\n            throw new PebbleException(e, \"Unable to fetch error logs\");\n        }\n    }\n}\n","sourceCodeStart":48,"sourceCodeEnd":70,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/functions/ErrorLogsFunction.java#L48-L70","documentation":"Thrown by 'errorLogs' when the underlying executionLogMetaStore.get().errorLogs(tenantId, executionId) call throws anything that is not a RetryUtils.RetryFailed (which is swallowed and returns an empty list). The retry is configured with exponential backoff and unlimited attempts capped at 5 seconds, so this fires only after retries are exhausted by a non-RetryFailed error or an unexpected Throwable.","triggerScenarios":"The 'flow' or 'execution' context variables are missing or malformed (a null tenantId/id from a context where they are not populated), the log store throws an unexpected runtime exception (auth, serialization, storage outage) that is not classified as RetryFailed, or the execution identifier does not resolve.","commonSituations":"Calling errorLogs() in a context where 'flow'/'execution' map variables are absent; a transient or persistent database/storage failure that the retry policy cannot clear; permissions/tenant mismatch on the log store.","solutions":["Ensure errorLogs() is called within a worker task that has a valid execution context (see error 144).","Check that the execution actually has error logs and that the log store (DB/indexer) is reachable and healthy.","If the error is transient, re-run the task; if persistent, inspect the worker logs for the wrapped cause to identify the storage/permissions problem."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"# The function already falls back to an empty list on RetryFailed; to avoid the PebbleException, ensure a valid worker execution context with 'flow' and 'execution' variables populated before calling errorLogs().","typeGuard":null,"tryCatchPattern":"# Pebble has no try/catch. Wrap in a custom task that calls errorLogs and catches Throwable to return an empty list, mirroring the RetryFailed branch.","preventionTips":["Call errorLogs() only in worker tasks with a populated execution context.","Keep the log store (DB/indexer) healthy and reachable.","Re-run transient failures; investigate persistent ones via worker logs.","Confirm the execution has error logs before relying on the result."],"tags":["pebble","errorlogs","worker","database","retry-exhausted","runtime-context"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}