{"record":{"id":"ed9802d4577ce23a","repo":"docker/cli","slug":"trust-revoke-has-been-cancelled","errorCode":null,"errorMessage":"trust revoke has been cancelled","messagePattern":"trust revoke has been cancelled","errorType":"console","errorClass":"cancelledErr","httpStatus":null,"severity":"info","filePath":"cmd/docker-trust/trust/revoke.go","lineNumber":52,"sourceCode":"\treturn cmd\n}\n\nfunc revokeTrust(ctx context.Context, dockerCLI command.Cli, remote string, options revokeOptions) error {\n\timgRefAndAuth, err := trust.GetImageReferencesAndAuth(ctx, authResolver(dockerCLI), remote)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttag := imgRefAndAuth.Tag()\n\tif imgRefAndAuth.Tag() == \"\" && imgRefAndAuth.Digest() != \"\" {\n\t\treturn errors.New(\"cannot use a digest reference for IMAGE:TAG\")\n\t}\n\tif imgRefAndAuth.Tag() == \"\" && !options.forceYes {\n\t\tdeleteRemote, err := prompt.Confirm(ctx, dockerCLI.In(), dockerCLI.Out(), fmt.Sprintf(\"Confirm you would like to delete all signature data for %s?\", remote))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !deleteRemote {\n\t\t\treturn cancelledErr{errors.New(\"trust revoke has been cancelled\")}\n\t\t}\n\t}\n\n\tnotaryRepo, err := newNotaryClient(dockerCLI, imgRefAndAuth, trust.ActionsPushAndPull)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = clearChangeList(notaryRepo); err != nil {\n\t\treturn err\n\t}\n\tdefer clearChangeList(notaryRepo)\n\tif err := revokeSignature(notaryRepo, tag); err != nil {\n\t\treturn fmt.Errorf(\"could not remove signature for %s: %w\", remote, err)\n\t}\n\t_, _ = fmt.Fprintf(dockerCLI.Out(), \"Successfully deleted signature for %s\\n\", remote)\n\treturn nil\n}","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cmd/docker-trust/trust/revoke.go#L34-L70","documentation":"Returned by revokeTrust (wrapped in a cancelledErr that implements Cancelled()) when no tag was supplied and the user answered 'No' to the confirmation prompt asking whether to delete all signature data for the repository. It is a user-initiated cancellation, not a system failure.","triggerScenarios":"Running 'docker trust revoke repo/image' (no tag) without -y; the prompt.Confirm call returns false, so revokeTrust returns cancelledErr at revoke.go:52.","commonSituations":"User hesitates about deleting all signatures; a non-interactive shell where the prompt defaults to no; scripting without -y that aborts on the safety check.","solutions":["Re-run and answer 'y' at the prompt if you really want to revoke all signatures.","Pass -y/--yes to skip the confirmation in scripts: 'docker trust revoke -y repo/image'.","Specify a single tag to revoke instead of all signatures if you only meant one."],"exampleFix":"# before: docker trust revoke repo/image  -> answered No\n# after:  docker trust revoke -y repo/image   # or revoke one tag: docker trust revoke repo/image:v1","handlingStrategy":"validation","validationCode":"// Detect the cancelledErr type (implements Cancelled()) and treat as non-fatal\nfunc isRevokeCancelled(err error) bool {\n\ttype cancelled interface{ Cancelled() }\n\tvar c cancelled\n\treturn errors.As(err, &c)\n}","typeGuard":"// Type guard for the cancellation sentinel\nfunc isCancelledErr(err error) bool {\n\ttype cancelled interface{ Cancelled() }\n\tvar c cancelled\n\treturn errors.As(err, &c)\n}","tryCatchPattern":"// In wrapping code, suppress cancelledErr instead of surfacing it as a failure\nerr := revokeTrust(...)\nif isRevokeCancelled(err) {\n    // user chose not to revoke — exit cleanly\n    return nil\n}\nreturn err","preventionTips":["Use -y in non-interactive scripts to avoid the confirmation prompt entirely.","Detect the Cancelled() interface and treat it as a clean exit, not an error.","Provide a single tag to revoke to avoid the all-signature confirmation prompt."],"tags":["trust","notary","revoke","cancellation","prompt"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}