{"record":{"id":"b29ef6ccc97f947a","repo":"affaan-m/ECC","slug":"error","errorCode":null,"errorMessage":"ERROR: $*","messagePattern":"ERROR: \\$\\*","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"skills/frontend-slides/scripts/export-pdf.sh","lineNumber":32,"sourceCode":"#   3. Combines all screenshots into a single PDF\n#   4. Cleans up the server and temp files\n#\n# The PDF preserves colors, fonts, and layout - but not animations.\n# Perfect for email attachments, printing, or embedding in documents.\nset -euo pipefail\n\n# --- Colors ---\nRED='\\033[0;31m'\nGREEN='\\033[0;32m'\nCYAN='\\033[0;36m'\nYELLOW='\\033[1;33m'\nBOLD='\\033[1m'\nNC='\\033[0m'\n\ninfo()  { echo -e \"${CYAN}INFO:${NC} $*\"; }\nok()    { echo -e \"${GREEN}OK:${NC} $*\"; }\nwarn()  { echo -e \"${YELLOW}WARNING:${NC} $*\"; }\nerr()   { echo -e \"${RED}ERROR:${NC} $*\" >&2; }\n\n# --- Parse flags ---\n\n# Default resolution: 1920x1080 (full HD, ~1-2MB per slide)\n# Compact resolution: 1280x720 (HD, ~50-70% smaller files)\nVIEWPORT_W=1920\nVIEWPORT_H=1080\nCOMPACT=false\n\nPOSITIONAL=()\nfor arg in \"$@\"; do\n    case $arg in\n        --compact)\n            COMPACT=true\n            VIEWPORT_W=1280\n            VIEWPORT_H=720\n            ;;\n        *)","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/affaan-m/ECC/blob/d8409a4b0813771235555e32e3d8046a73988bfa/skills/frontend-slides/scripts/export-pdf.sh#L14-L50","documentation":"err() at line 32 of skills/frontend-slides/scripts/export-pdf.sh prints 'ERROR: <text>' in red to stderr and, combined with set -euo pipefail, aborts the slide-deck PDF export. The live call sites enumerate the script's failure modes: usage errors (missing arguments), input HTML file not found, Node.js not installed, Playwright npm install failure, Chromium browser install failure (npx playwright install chromium), and the final 'PDF export failed.' from the headless render step.","triggerScenarios":"Running `bash scripts/export-pdf.sh` with no arguments or a wrong HTML path; executing on a machine without Node.js on PATH; `npm install playwright` failing (offline registry, proxy); `npx playwright install chromium` failing (download blocked); the headless Chromium render throwing on malformed HTML or missing file:// asset paths.","commonSituations":"Fresh machines missing the Node/Playwright/Chromium prerequisite chain; corporate proxies blocking npm or Playwright's browser CDN; decks referencing absolute asset paths that do not exist where the script runs.","solutions":["Re-run with the documented usage: bash scripts/export-pdf.sh <path-to-html> [output.pdf] [--compact] and verify the input file exists.","Install prerequisites: Node.js (brew install node or nodejs.org), then npm install playwright and npx playwright install chromium — the two steps the script attempts automatically.","For 'PDF export failed.', open the same HTML in a normal browser first and check the devtools console; fix broken asset/script references.","If installs fail behind a proxy, configure npm/HTTPS_PROXY so the automatic installs can reach the registry and browser CDN."],"exampleFix":"# before\nbash export-pdf.sh                      # ERROR: Usage: bash scripts/export-pdf.sh <path-to-html> [output.pdf] [--compact]\n\n# after\nbash skills/frontend-slides/scripts/export-pdf.sh ./presentation.html ./slides.pdf","handlingStrategy":"validation","validationCode":"# Preflight the script's prerequisites before invoking it\ncommand -v node >/dev/null 2>&1 || { echo 'install Node.js first'; exit 1; }\n[ -f \"$DECK_HTML\" ] || { echo \"input HTML missing: $DECK_HTML\"; exit 1; }\nnode -e \"require('playwright')\" 2>/dev/null || npm install playwright\nnpx playwright install chromium","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install the Node + Playwright + Chromium chain once per machine (or bake it into your image) before running exports.","Pass the deck path as a checked variable, not a hand-typed argument.","Keep deck asset references relative to the HTML file so headless Chromium can resolve them.","Configure proxy/registry env for npm and the Playwright browser CDN in restricted networks."],"tags":["shell","cli","playwright","pdf-export","prerequisites"],"backgroundTag":"script-dependency-missing","analyzedSha":"d8409a4b0813771235555e32e3d8046a73988bfa","analyzedAt":"2026-08-26T12:15:34.022Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}