{"record":{"id":"5b5c0db9a9ccafc5","repo":"apache/superset","slug":"failed-taking-a-screenshot-str-ex","errorCode":null,"errorMessage":"Failed taking a screenshot {str(ex)}","messagePattern":"Failed taking a screenshot (.+?)","errorType":"exception","errorClass":"ReportScheduleScreenshotFailedError","httpStatus":500,"severity":"error","filePath":"superset/commands/report/execute.py","lineNumber":845,"sourceCode":"        except ReportExecutionBudgetExceededError:\n            raise\n        except Exception as ex:\n            elapsed_seconds = (\n                datetime.now(timezone.utc).replace(tzinfo=None) - start_time\n            ).total_seconds()\n            logger.error(\n                \"report_capture_terminal %s elapsed_seconds=%.2f \"\n                \"remaining_seconds=%s terminal_reason=%s\",\n                self._log_context,\n                elapsed_seconds,\n                (\n                    f\"{self._report_execution_context.deadline.remaining_seconds:.2f}\"\n                    if self._report_execution_context\n                    else None\n                ),\n                type(ex).__name__,\n            )\n            raise ReportScheduleScreenshotFailedError(\n                f\"Failed taking a screenshot {str(ex)}\"\n            ) from ex\n        if not imges:\n            raise ReportScheduleScreenshotFailedError()\n        return imges\n\n    def _get_pdf(self) -> bytes:\n        \"\"\"\n        Get chart or dashboard pdf\n        :raises: ReportSchedulePdfFailedError\n        \"\"\"\n        screenshots = self._get_screenshots()\n        reserve_seconds = (\n            self._report_execution_context.post_capture_reserve_seconds\n            if self._report_execution_context\n            else 0.0\n        )\n        self._phase_timeout(","sourceCodeStart":827,"sourceCodeEnd":863,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/report/execute.py#L827-L863","documentation":"ReportScheduleScreenshotFailedError wrapping an unexpected exception from the screenshot path: after logging a 'report_capture_terminal' error line (with elapsed seconds, remaining budget, and the terminal exception type name), the generic Exception is re-raised as this typed error with the original message appended ('Failed taking a screenshot {str(ex)}').","triggerScenarios":"Any non-timeout exception inside get_screenshot: playwright connection refused (screenshot service down), HTTP error fetching the report URL, auth failure during the capture session, unexpected None attribute in the playwright wrapper.","commonSituations":"Screenshot service (windowed playwright) not running or unreachable; SESSION cookie/token issues for the executor user; upgrades that changed the playwright protocol; TLS certificate problems on the internal report URL.","solutions":["Read the terminal_reason in the preceding log line — it names the underlying exception type to chase","Verify the screenshot/playwright worker is up and the configured internal endpoint (SUPERSET_WEBDRIVER/SCREENSHOT service) is reachable from the worker","Reproduce manually: log in as the executor user and open the report URL the worker captures"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"def screenshot_service_healthy(base_url: str) -> bool:\n    import requests\n    try:\n        return requests.get(base_url, timeout=5).status_code < 500\n    except requests.RequestException:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    _get_screenshots()\nexcept ReportScheduleScreenshotFailedError as ex:\n    # str(ex) embeds the underlying cause; log terminal_reason for triage\n    logger.error('screenshot failed: %s', ex)\n    raise","preventionTips":["Health-check the screenshot worker before scheduled bursts","Watch the 'report_capture_terminal' log line — terminal_reason names the root exception","Keep the executor user's session/auth path working (password resets can break captures)"],"tags":["alerts-reports","screenshot","playwright","execution"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}