affaan-m/ECC · error
ERROR: $*
Error message
ERROR: $*
What it means
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.
Source
Thrown at skills/frontend-slides/scripts/export-pdf.sh:32
# 3. Combines all screenshots into a single PDF
# 4. Cleans up the server and temp files
#
# The PDF preserves colors, fonts, and layout - but not animations.
# Perfect for email attachments, printing, or embedding in documents.
set -euo pipefail
# --- Colors ---
RED='\033[0;31m'
GREEN='\033[0;32m'
CYAN='\033[0;36m'
YELLOW='\033[1;33m'
BOLD='\033[1m'
NC='\033[0m'
info() { echo -e "${CYAN}INFO:${NC} $*"; }
ok() { echo -e "${GREEN}OK:${NC} $*"; }
warn() { echo -e "${YELLOW}WARNING:${NC} $*"; }
err() { echo -e "${RED}ERROR:${NC} $*" >&2; }
# --- Parse flags ---
# Default resolution: 1920x1080 (full HD, ~1-2MB per slide)
# Compact resolution: 1280x720 (HD, ~50-70% smaller files)
VIEWPORT_W=1920
VIEWPORT_H=1080
COMPACT=false
POSITIONAL=()
for arg in "$@"; do
case $arg in
--compact)
COMPACT=true
VIEWPORT_W=1280
VIEWPORT_H=720
;;
*)View on GitHub (pinned to d8409a4b08)
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.
Example fix
# before bash export-pdf.sh # ERROR: Usage: bash scripts/export-pdf.sh <path-to-html> [output.pdf] [--compact] # after bash skills/frontend-slides/scripts/export-pdf.sh ./presentation.html ./slides.pdf
Defensive patterns
Strategy: validation
Validate before calling
# Preflight the script's prerequisites before invoking it
command -v node >/dev/null 2>&1 || { echo 'install Node.js first'; exit 1; }
[ -f "$DECK_HTML" ] || { echo "input HTML missing: $DECK_HTML"; exit 1; }
node -e "require('playwright')" 2>/dev/null || npm install playwright
npx playwright install chromium Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
AI-assisted analysis of affaan-m/ECC@d8409a4b08 (2026-08-26).
Data as JSON: /api/errors/b29ef6ccc97f947a.
Report an issue: GitHub.