Skip to content
Latchkey

Deno "PermissionDenied: Requires write access" in CI

Deno blocked a filesystem write because --allow-write was not granted. The message names the path the program tried to create or modify.

What this error means

The run fails with "PermissionDenied: Requires write access to \"/path\", run again with the --allow-write flag" when the program writes output, a cache, or a temp file.

deno
error: Uncaught (in promise) PermissionDenied: Requires write access to "dist/out.json", run again with the --allow-write flag
    at Object.writeFileSync (ext:deno_fs/30_fs.js:...)

Common causes

No --allow-write in the CI command

The build or test step writes artifacts but the invocation grants no write permission, so the first write is denied.

Writing outside the granted write scope

A scoped --allow-write=./dist does not cover a program that also writes to a temp directory or the workspace root.

How to fix it

Grant write access to the output paths

  1. Read the path Deno reports.
  2. Add --allow-write=<path> for the directories the program writes.
  3. Re-run the step to confirm the write succeeds.
Terminal
deno run --allow-read=. --allow-write=./dist build.ts

Include temp locations when needed

If the program writes to a system temp directory, add that path (or the workspace) to the write scope.

Terminal
deno run --allow-write=./dist,/tmp build.ts

How to prevent it

  • Scope --allow-write to output directories, not the whole disk.
  • Keep write flags in the CI command matched to where the program writes.
  • Direct generated files into a known output folder you can scope.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →