{"record":{"id":"52714df9cbf35849","repo":"FiloSottile/age","slug":"client-failed-to-display-message","errorCode":null,"errorMessage":"client failed to display message","messagePattern":"client failed to display message","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"plugin/plugin.go","lineNumber":512,"sourceCode":"\treturn 0\n}\n\n// DisplayMessage requests that the client display a message to the user. The\n// message should start with a lowercase letter and have no final period.\n// DisplayMessage returns an error if the client can't display the message, and\n// may return before the message has been displayed to the user.\n//\n// It must only be called by a Wrap or Unwrap method invoked by [Plugin.Main].\nfunc (p *Plugin) DisplayMessage(message string) error {\n\tif err := writeStanzaWithBody(p.stdout, \"msg\", []byte(message)); err != nil {\n\t\treturn p.fatalInteractf(\"failed to write msg stanza: %v\", err)\n\t}\n\ts, err := readOkOrFail(p.sr)\n\tif err != nil {\n\t\treturn p.fatalInteractf(\"%v\", err)\n\t}\n\tif s.Type == \"fail\" {\n\t\treturn fmt.Errorf(\"client failed to display message\")\n\t}\n\tif err := expectStanzaWithNoBody(s, 0); err != nil {\n\t\treturn p.fatalInteractf(\"%v\", err)\n\t}\n\treturn nil\n}\n\n// RequestValue requests a secret or public input from the user through the\n// client, with the provided prompt. It returns an error if the client can't\n// request the input or if the user dismisses the prompt.\n//\n// It must only be called by a Wrap or Unwrap method invoked by [Plugin.Main].\nfunc (p *Plugin) RequestValue(prompt string, secret bool) (string, error) {\n\tt := \"request-public\"\n\tif secret {\n\t\tt = \"request-secret\"\n\t}\n\tif err := writeStanzaWithBody(p.stdout, t, []byte(prompt)); err != nil {","sourceCodeStart":494,"sourceCodeEnd":530,"githubUrl":"https://github.com/FiloSottile/age/blob/b74dce4cdbe35b5e5f66c06d9612b72f89028758/plugin/plugin.go#L494-L530","documentation":"DisplayMessage is used by the plugin to show a message to the user via the age client's display-message protocol command. This error means the client answered the ok-or-fail exchange with a \"fail\" stanza — the client could not or refused to display the message. The plugin surfaces it as a normal error rather than a fatal interaction failure.","triggerScenarios":"The age client running the plugin does not support display-message or its UI has no way to show messages (e.g. headless/batch mode); the client explicitly fails the request.","commonSituations":"Running age in a non-interactive environment (CI, scripts) where the client cannot show GUI/dialog messages; an old age client version lacking the display-message command; a client UI that drops the message.","solutions":["Treat the display as best-effort and continue without it, or surface the message through stderr instead","Run age in an environment where the client can display messages","Upgrade the age client to a version supporting the display-message plugin command"],"exampleFix":"// before\nif err := p.DisplayMessage(\"confirm device presence\"); err != nil { return err }\n// after\nif err := p.DisplayMessage(\"confirm device presence\"); err != nil {\n    fmt.Fprintf(os.Stderr, \"note: %s\\n\", \"confirm device presence\") // continue\n}","handlingStrategy":"try-catch","validationCode":"// Prefer running age interactively; check TTY before non-interactive flows:\n// stat, _ := os.Stdin.Stat(); interactive := stat.Mode()&os.ModeCharDevice != 0","typeGuard":null,"tryCatchPattern":"if err := p.DisplayMessage(msg); err != nil {\n    // non-fatal: log to stderr and continue\n    fmt.Fprintf(os.Stderr, \"display skipped: %v\\n\", err)\n}","preventionTips":["Treat DisplayMessage as best-effort, not a required step","Avoid headless environments for plugins needing user messages","Check client age version supports plugin UI commands"],"tags":["age","plugin","ui","client-interaction"],"backgroundTag":"plugin-client-interaction-failed","analyzedSha":"b74dce4cdbe35b5e5f66c06d9612b72f89028758","analyzedAt":"2026-08-31T23:59:31.627Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}