gchq/CyberChef · error · OperationError

Unable to find decompression function

Error message

Unable to find decompression function

What it means

Thrown by LZString Decompress when the selected format has no entry in the DECOMPRESSION_FUNCTIONS map. Same defensive pattern as the compress operation: the dropdown binds the option to known formats, and this fires only for an out-of-map value or a missing args[0].

Source

Thrown at src/core/operations/LZStringDecompress.mjs:49

                name: "Compression Format",
                type: "option",
                defaultIndex: 0,
                value: COMPRESSION_OUTPUT_FORMATS
            }
        ];
    }

    /**
     * @param {string} input
     * @param {Object[]} args
     * @returns {string}
     */
    run(input, args) {
        const decompress = DECOMPRESSION_FUNCTIONS[args[0]];
        if (decompress) {
            return decompress(input);
        } else {
            throw new OperationError("Unable to find decompression function");
        }
    }


}

export default LZStringDecompress;

View on GitHub (pinned to 4290ea7539)

Solutions

  1. Choose a format from the dropdown so it matches a known decompressor.
  2. Validate against Object.keys(DECOMPRESSION_FUNCTIONS) before calling programmatically.
  3. Keep the formats list and the functions map aligned when maintaining the module.
  4. Ensure the decompress format matches the format the data was compressed with.

Example fix

// before: format mismatch
chef.LZStringDecompress(data, ['UnknownFormat']);
// after: matching decompressor
chef.LZStringDecompress(data, ['Base64']);
Defensive patterns

Strategy: validation

Validate before calling

function ensureDecompressionFormat(format) {
  if (!Object.prototype.hasOwnProperty.call(DECOMPRESSION_FUNCTIONS, format))
    throw new Error(`Unknown LZ decompression format: ${format}`);
  return format;
}

Type guard

function isKnownDecompressionFormat(f) {
  return Object.prototype.hasOwnProperty.call(DECOMPRESSION_FUNCTIONS, f);
}

Try / catch

try {
  return chef.LZStringDecompress(input, [format]);
} catch (e) {
  if (/Unable to find decompression function/.test(e.message))
    throw new Error('Pick a format listed in the dropdown, matching the compression');
  throw e;
}

Prevention

When it happens

Trigger: A recipe supplies a format string not in DECOMPRESSION_FUNCTIONS. Drift between the options list and the decompression map. Programmatic call passing an unrecognised format. args[0] undefined.

Common situations: Hand-editing the recipe option. Version mismatch importing recipes. Editing the format list without updating the function map.

Related errors


AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13). Data as JSON: /api/errors/809f11e3d8d6cb19. Report an issue: GitHub.