FiloSottile/age · info

user cancelled prompt

Error message

user cancelled prompt

What it means

In the plugin's interactive TUI confirm prompt, pressing CTRL-C (byte 0x03) aborts the prompt. The code converts that keypress into the error "user cancelled prompt" so the plugin/client knows the user declined to proceed. This is intentional cancellation, not a malfunction.

Source

Thrown at plugin/tui.go:68

				_, err := term.ReadSecret(message)
				if err != nil {
					return false, err
				}
				return true, nil
			}
			message += fmt.Sprintf(" (press [1] for %q or [2] for %q)", yes, no)
			for {
				selection, err := term.ReadCharacter(message)
				if err != nil {
					return false, err
				}
				switch selection {
				case '1':
					return true, nil
				case '2':
					return false, nil
				case '\x03': // CTRL-C
					return false, errors.New("user cancelled prompt")
				default:
					warningf("reading value for age-plugin-%s: invalid selection %q", name, selection)
				}
			}
		},
		WaitTimer: func(name string) {
			printf("waiting on %s plugin...", name)
		},
	}
}

View on GitHub (pinned to b74dce4cdb)

Solutions

  1. Treat this error as normal cancellation in the client: abort the operation quietly without reporting it as a failure.
  2. Detect errors.Is(err, ...) or match the message to distinguish user cancel from real errors.
  3. If prompts must not be interruptible in automation, provide input non-interactively per the plugin's documented protocol.

Example fix

// before
if err != nil { return err } // surfaces cancel as a scary failure
// after
if err != nil {
    if strings.Contains(err.Error(), "user cancelled prompt") {
        return errPluginCancelled
    }
    return err
}
Defensive patterns

Strategy: try-catch

Try / catch

if err != nil {
    if strings.Contains(err.Error(), "user cancelled prompt") {
        return nil // or a sentinel cancel error
    }
    return err
}

Prevention

When it happens

Trigger: User presses CTRL-C while the age-plugin-<name> TUI confirmation dialog (yes/no selection) is displayed.

Common situations: Users aborting an interactive passphrase/consent prompt during age encryption with a plugin; scripted runs where the user sees the prompt and interrupts it.

Related errors


AI-assisted analysis of FiloSottile/age@b74dce4cdb (2026-08-31). Data as JSON: /api/errors/fba7f24649d2594f. Report an issue: GitHub.