jruby/jruby · error · IllegalArgumentException

${encoding} is not supported

Error message

${encoding} is not supported

What it means

Error "${encoding} is not supported" thrown in jruby/jruby.

Source

Thrown at core/src/main/java/org/jruby/embed/io/WriterOutputStream.java:80

    public WriterOutputStream(Writer writer) {
        this(writer, null);
    }

    /**
     * Creates WriterOutputStream from given java.io.Writer object with a specified encoding.
     *
     * @param writer java.io.Writer object to be converted to.
     */
    public WriterOutputStream(Writer writer, String encoding) {
        this.writer = writer;       
        if (encoding == null && writer instanceof OutputStreamWriter) {
            // this encoding might be null when writer has been closed
            encoding = ((OutputStreamWriter) writer).getEncoding();
        }
        if (encoding == null) {
            encoding = Charset.defaultCharset().name();
        } else if (!Charset.isSupported(encoding)) {
            throw new IllegalArgumentException(encoding + " is not supported");
        }
        decoder = Charset.forName(encoding).newDecoder();
        decoder.onMalformedInput(CodingErrorAction.REPLACE);
        decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
    }

    /**
     * Closes this output stream and releases any system resources
     * associated with this stream. The general contract of <code>close</code>
     * is that it closes the output stream. A closed stream cannot perform
     * output operations and cannot be reopened.
     * <p>
     * 
     * @exception  IOException  if an I/O error occurs.
     */
    @Override
    public void close() throws IOException {
        synchronized (writer) {

View on GitHub (pinned to fb650c13e0)

Solutions

  1. The requested charset is not supported by this JVM. Choose a supported encoding with Charset.isSupported() (UTF-8 always works) before constructing the WriterOutputStream.

When it happens

Trigger: Thrown at core/src/main/java/org/jruby/embed/io/WriterOutputStream.java:80 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of jruby/jruby@fb650c13e0 (2026-08-23). Data as JSON: /api/errors/ccaa135c8fbcac92. Report an issue: GitHub.