apache/maven · error · PrompterException

Unable to showMessage

Error message

Unable to showMessage

What it means

Thrown when displaying a message through the legacy interactivity adapter fails. LegacyPlexusInteractivity.showMessage() calls prompter.showMessage(message) and wraps any org.apache.maven.api.services.PrompterException in a legacy PrompterException ('Unable to showMessage'). It is write-only output, so failure means the output side of the console (stdout/stderr writer) threw, not user input.

Source

Thrown at compat/maven-compat/src/main/java/org/apache/maven/internal/compat/interactivity/LegacyPlexusInteractivity.java:147

            throw new PrompterException("Unable to prompt", e);
        }
    }

    @Override
    public String promptForPassword(String message) throws PrompterException {
        try {
            return prompter.promptForPassword(message);
        } catch (org.apache.maven.api.services.PrompterException e) {
            throw new PrompterException("Unable to promptForPassword", e);
        }
    }

    @Override
    public void showMessage(String message) throws PrompterException {
        try {
            prompter.showMessage(message);
        } catch (org.apache.maven.api.services.PrompterException e) {
            throw new PrompterException("Unable to showMessage", e);
        }
    }
}

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Check that stdout/stderr of the process is open and consumers of a pipe stay alive for the whole run
  2. Avoid showMessage for bulk output; use the logger, which tolerates stream failures better
  3. Catch PrompterException around display calls in legacy adapters and degrade to a no-op or log
  4. Do not close System.out in embedded/daemon usage before Maven finishes

Example fix

// before
prompter.showMessage("Important notice");
// after
try {
    prompter.showMessage("Important notice");
} catch (PrompterException e) {
    logger.warn("Could not display message to user: {}", e.getMessage());
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Ensure the process output stream is usable before display-heavy flows
boolean outputOk = System.out != null && !System.out.checkError();

Try / catch

try {
    prompter.showMessage(message);
} catch (PrompterException e) {
    logger.debug("showMessage failed; continuing", e); // display is non-critical
}

Prevention

When it happens

Trigger: Calling showMessage(String) when the underlying Prompter's output stream fails: closed stdout, broken pipe (output piped to a consumer that exited), or disk/full-buffer I/O error on a redirected stream.

Common situations: Piping Maven output to head/less and the consumer exits early (SIGPIPE); legacy plugins printing progress via the Plexus Prompter in redirected or daemonized environments; embedding Maven where System.out has been closed.

Related errors


AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21). Data as JSON: /api/errors/cf08fd470a0d1767. Report an issue: GitHub.