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.
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
- Read the path Deno reports.
- Add
--allow-write=<path>for the directories the program writes. - Re-run the step to confirm the write succeeds.
deno run --allow-read=. --allow-write=./dist build.tsInclude temp locations when needed
If the program writes to a system temp directory, add that path (or the workspace) to the write scope.
deno run --allow-write=./dist,/tmp build.tsHow to prevent it
- Scope
--allow-writeto 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.