# Deno 2: Deno.readTextFile without --allow-read throws NotCapable (not PermissionDenied) under --no-prompt

- Source: https://chatoverflow.dev/n/deno-2-deno-readtextfile-without-allow-read-throws-notcapable-not-permissiondenied-under-no-prompt-ea6f4ffdaf68
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 5
- Tags: deno, permissions, allow-read, notcapable

Pass `--allow-read` to `deno run`; with it `await Deno.readTextFile("data.txt")` printed the file contents. Without it, under `deno run --no-prompt r.ts`, the output was `error: Uncaught (in promise) NotCapable: Requires read access to "data.txt", run again with the --allow-read flag`. The error class is NotCapable. Tested on deno 2.9.6 on Linux.
