`wrangler pages deployment delete` exits 0 without deleting when it cannot prompt

Open Beginner friendly
#17,158 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cli, typescript
Domain
cli

Research direction

The delete prompt is the confirm(..., { fallbackValue: false }) call in packages/wrangler/src/pages/deployments.ts around lines 177-186. Compare it with the non-interactive --force check that wrangler queues purge already performs, and read that command's test to see how it is exercised. Done means that running delete with no TTY and no --force exits non-zero with a message naming --force, and that a declined interactive prompt prints a "Not deleting." line.

Written by the indexing model from the issue text.

Description

What versions & operating system are you using?

Wrangler 4.166.0, Node v24.19.0, Windows 11 (10.0.26300). The same code path is on main as of 2026-11-24 (wrangler 4.168.0).

Please provide a link to a minimal reproduction

https://github.com/cloudflare/workers-sdk/blob/0c06246f05e847da853b283448f7a760189a7c2a/packages/wrangler/src/pages/deployments.ts#L177-L186

Describe the Bug

wrangler pages deployment delete asks for confirmation with confirm(..., { fallbackValue: false }). When Wrangler cannot prompt (no TTY, or CI), confirm() answers with the fallback "no", the handler returns, nothing is deleted, and the process exits with code 0.

Steps to reproduce (any shell without a TTY, for example a CI job or a script):

wrangler pages deployment delete <deployment-id> --project-name <project> < /dev/null
echo $?   # 0

The output shows the question and the fallback answer, but nothing says that the deployment was not deleted, and the exit code is 0:

? Are you sure you want to delete deployment "<deployment-id>" in project "<project>"? This action cannot be undone.
🤖 Using fallback value in non-interactive context: no

A cleanup job that runs this sees success while the deployment is still there.

Expected: exit non-zero with a message that says to pass --force, the way wrangler queues purge already does in non-interactive mode ("The --force flag is required to purge a Queue in non-interactive mode").

Related: --force is the only way past the prompt, and it is also sent to the API as force=true (since #13444), which deletes deployments that still have an active alias. So a script that only wants to skip the prompt has to opt into deleting aliased deployments as well.

This is not about the default answer discussed in #17098: this command already defaults to "no". It is only about that outcome being invisible to the caller.

I have a small fix with tests ready (an error and non-zero exit when --force is missing in a non-interactive context, and a "Not deleting." line when the prompt is declined interactively) and am happy to open a PR if that is welcome.

Found while tidying old deployments on my own Pages sites. The report and the fix were prepared with help from Claude (Anthropic).

Please provide any relevant error logs

None: that is the problem. See the output above.

Dominant language
TypeScript
Stars
4.7k
Forks
1.7k
Avg merge
1d 22h
Merged PRs (30d)
282

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cloudflare/workers-sdk

All issues in cloudflare/workers-sdk

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.