{"id":"b095329fb0aa9355","repo":"docker/cli","slug":"system-prune-has-been-cancelled","errorCode":null,"errorMessage":"system prune has been cancelled","messagePattern":"system prune has been cancelled","errorType":"exception","errorClass":"cancelledErr","httpStatus":null,"severity":"info","filePath":"cli/command/system/prune.go","lineNumber":87,"sourceCode":"Are you sure you want to continue?`\n\nfunc runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions) error {\n\t// prune requires either force, or a user to confirm after prompting.\n\tconfirmed := options.force\n\n\t// Validate the given options for each pruner and construct a confirmation-message.\n\tconfirmationMessage, err := dryRun(ctx, dockerCli, options)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !confirmed {\n\t\tvar err error\n\t\tconfirmed, err = prompt.Confirm(ctx, dockerCli.In(), dockerCli.Out(), confirmationMessage)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !confirmed {\n\t\t\treturn cancelledErr{errors.New(\"system prune has been cancelled\")}\n\t\t}\n\t}\n\n\tvar spaceReclaimed uint64\n\tfor contentType, pruneFn := range pruner.List() {\n\t\tswitch contentType {\n\t\tcase pruner.TypeVolume:\n\t\t\tif !options.pruneVolumes {\n\t\t\t\tcontinue\n\t\t\t}\n\t\tcase pruner.TypeContainer, pruner.TypeNetwork, pruner.TypeImage, pruner.TypeBuildCache:\n\t\t\t// no special handling; keeping the \"exhaustive\" linter happy.\n\t\tdefault:\n\t\t\t// other pruners; no special handling; keeping the \"exhaustive\" linter happy.\n\t\t}\n\n\t\tspc, output, err := pruneFn(ctx, dockerCli, pruner.PruneOptions{\n\t\t\tConfirmed: confirmed,","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/system/prune.go#L69-L105","documentation":"Returned by `docker system prune` when the interactive confirmation prompt is answered with anything other than yes. It is wrapped in cancelledErr, which the CLI maps to a non-error-looking cancellation (exit code handling for user aborts), signalling that no pruning was performed.","triggerScenarios":"Running `docker system prune` without --force and answering 'N' (or pressing Enter) at the \"Are you sure you want to continue?\" prompt; also when stdin closes/EOF causes the confirmation to resolve false, e.g. in a non-interactive shell.","commonSituations":"CI pipelines or cron jobs running `docker system prune` without -f, where there is no TTY so the prompt is auto-declined; users deliberately aborting after reading the warning about what will be deleted.","solutions":["If pruning was intended non-interactively, pass --force: `docker system prune -f` (add --volumes/-a deliberately, they widen deletion scope).","If you cancelled on purpose, no action needed — nothing was removed.","In scripts, always use -f and explicit filters (e.g. --filter until=24h) rather than relying on prompts."],"exampleFix":"# before (hangs/cancels in CI)\ndocker system prune\n\n# after\ndocker system prune -f --filter \"until=24h\"","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker-cli","prune","user-cancelled","ci"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}