DrKLO/Telegram · error
%s: sorry, multi-scan output was not compiled in
Error message
%s: sorry, multi-scan output was not compiled in
What it means
cjpeg emits this when the -scans switch is supplied but the binary was compiled without C_MULTISCAN_FILES_SUPPORTED defined (i.e. multi-scan/progressive JPEG output support was compiled out). The tool recognizes the switch, prints this message via fprintf to stderr, and aborts with exit(EXIT_FAILURE). It is a build-configuration mismatch, not a runtime argument error.
Source
Thrown at TMessagesProj/jni/mozjpeg/cjpeg.c:531
} else if (keymatch(arg, "sample", 2)) {
/* Set sampling factors. */
if (++argn >= argc) /* advance to next argument */
usage();
samplearg = argv[argn];
/* Must delay setting sample factors until after we have processed any
* colorspace-determining switches, since jpeg_set_colorspace sets
* default sampling factors.
*/
} else if (keymatch(arg, "scans", 4)) {
/* Set scan script. */
#ifdef C_MULTISCAN_FILES_SUPPORTED
if (++argn >= argc) /* advance to next argument */
usage();
scansarg = argv[argn];
/* We must postpone reading the file in case -progressive appears. */
#else
fprintf(stderr, "%s: sorry, multi-scan output was not compiled in\n",
progname);
exit(EXIT_FAILURE);
#endif
} else if (keymatch(arg, "smooth", 2)) {
/* Set input smoothing factor. */
int val;
if (++argn >= argc) /* advance to next argument */
usage();
if (sscanf(argv[argn], "%d", &val) != 1)
usage();
if (val < 0 || val > 100)
usage();
cinfo->smoothing_factor = val;
} else if (keymatch(arg, "targa", 1)) {
/* Input file is Targa format. */View on GitHub (pinned to 45ab8f4308)
Solutions
- Recompile mozjpeg with C_MULTISCAN_FILES_SUPPORTED enabled (ensure jconfig.h / jmorecfg.h do not undef it, and the build system's WITH_MULTISCAN or equivalent option is on).
- If you cannot rebuild, drop the -scans option and use a single-scan output instead, or use -progressive only if C_PROGRESSIVE_SUPPORTED is enabled.
- Verify the rebuilt binary: run cjpeg -verbose -scans /dev/null on a throwaway input and confirm it no longer exits with this message.
Example fix
# before cjpeg -scans myscript.txt input.ppm > out.jpg # after (rebuild with C_MULTISCAN_FILES_SUPPORTED, then) cjpeg -scans myscript.txt input.ppm > out.jpg # or, if you cannot rebuild, omit -scans: cjpeg input.ppm > out.jpg
Defensive patterns
Strategy: validation
Validate before calling
#!/bin/sh # Guard before invoking cjpeg with -scans: probe whether this build supports it. printf '' | cjpeg -scans /dev/null 2>/tmp/probe.err >/dev/null if grep -q 'multi-scan output was not compiled in' /tmp/probe.err 2>/dev/null; then echo 'ERROR: this cjpeg build lacks multi-scan support; rebuild or drop -scans' >&2 exit 1 fi cjpeg -scans script.txt in.ppm > out.jpg
Type guard
// n/a: cjpeg is a CLI process, not a typed API. Guard at the shell/script layer.
Try / catch
# cjpeg calls exit() directly; there is no in-process exception.
# Wrap as subprocess and check exit code:
if ! cjpeg -scans script.txt in.ppm > out.jpg 2>cjpeg.err; then
if grep -q 'multi-scan output was not compiled in' cjpeg.err; then
echo 'rebuild mozjpeg with C_MULTISCAN_FILES_SUPPORTED or drop -scans' >&2
fi
exit 1
fi Prevention
- Document which optional mozjpeg feature macros your binary was built with.
- In CI, assert the feature set with a probe command before shipping a tool that uses -scans.
- Keep build flags (jconfig.h) under version control and review them on dependency upgrades.
When it happens
Trigger: Running cjpeg with the -scans <scriptfile> option on a mozjpeg/libjpeg build where the C_MULTISCAN_FILES_SUPPORTED macro was left undefined at compile time (e.g. jconfig with the option disabled, or a stripped/minimal build).
Common situations: Cross-compile or embedded builds (such as the TMessagesProj NDK build) where optional codec features are turned off to shrink binary size; upgrading libjpeg/mozjpeg and inheriting a more restrictive jconfig; using a distro-provided cjpeg that was built conservatively.
Related errors
- %s: sorry, multi-scan output was not compiled
- %s: sorry, arithmetic coding not supported
- %s: missing argument for dct
- %s: invalid argument for dct
- %s: missing argument for dc-scan-opt
AI-assisted analysis of DrKLO/Telegram@45ab8f4308 (2026-08-14).
Data as JSON: /api/errors/b51459e55b6e84ec.
Report an issue: GitHub.