mozilla/pdf.js · error · FormatError

Bad filter name "${filter}"

Error message

Bad filter name "${filter}"

What it means

Error "Bad filter name "${filter}"" thrown in mozilla/pdf.js.

Source

Thrown at src/core/parser.js:817

        warn("/DecodeParms should not be an Array, when /Filter is a Name.");
      }
      return this.makeFilter(
        stream,
        filter.name,
        length,
        params,
        cipherTransform
      );
    }

    let maybeLength = length;
    if (Array.isArray(filter)) {
      const filterArray = filter;
      const paramsArray = params;
      for (let i = 0, ii = filterArray.length; i < ii; ++i) {
        filter = this.#fetchIfRef(filterArray[i]);
        if (!(filter instanceof Name)) {
          throw new FormatError(`Bad filter name "${filter}"`);
        }

        params = null;
        if (Array.isArray(paramsArray) && i in paramsArray) {
          params = this.#fetchIfRef(paramsArray[i]);
        }
        stream = this.makeFilter(
          stream,
          filter.name,
          maybeLength,
          params,
          cipherTransform
        );
        // After the first stream the `length` variable is invalid.
        maybeLength = null;
      }
    }
    return stream;

View on GitHub (pinned to 5903d58d58)

Solutions

  1. Check the stream's /Filter entry: it must be a valid filter name (e.g. FlateDecode, DCTDecode, JPXDecode) or an array of valid names.
  2. Remove or correct misspelled or unsupported filter names in the PDF.

When it happens

Trigger: Thrown at src/core/parser.js:817 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of mozilla/pdf.js@5903d58d58 (2026-08-13). Data as JSON: /api/errors/c2d1b0fdb377e0bd. Report an issue: GitHub.