Skip to content

dev-visualizer: export-paged-report.mjs fails with cryptic Chrome error when the output directory does not exist #181

Description

@lidge-jun

Symptom

First export attempt into a not-yet-existing directory fails with an error that names neither the cause nor the fix:

export-paged-report: chrome print failed: Return: -6670
[ERROR] Failed to write file /.../tmp/vis-test-report.pdf: No such file or directory (2)

Return: -6670 is Chrome's CVDisplayLink noise; the real signal (ENONENT dir) is buried in the headless stderr tail.

Repro

  • skills/dev-visualizer/scripts/export-paged-report.mjs assets/paged-report.html /some/new/dir/out.pdf
  • /some/new/dir does not exist.
  • Observed 2026-09-16, macOS, Google Chrome headless (--headless=new --print-to-pdf), plugin snapshot 0.2.28+codex.20260914090142; same code confirmed on main (plugins/codexclaw/skills/dev-visualizer/scripts/export-paged-report.mjs).

Cause

printPdf() spawns Chrome before ensuring dirname(output) exists. The second-pass TOC tmp file is safe (it lands next to the input); only the output path is exposed.

Suggested fix

mkdirSync(dirname(output), { recursive: true }) before the first printPdf() call, or catch and rethrow as output directory does not exist: <path>.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions