{"record":{"id":"b51459e55b6e84ec","repo":"DrKLO/Telegram","slug":"s-sorry-multi-scan-output-was-not-compiled-in","errorCode":null,"errorMessage":"%s: sorry, multi-scan output was not compiled in\n","messagePattern":"(.+?): sorry, multi-scan output was not compiled in\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"TMessagesProj/jni/mozjpeg/cjpeg.c","lineNumber":531,"sourceCode":"    } else if (keymatch(arg, \"sample\", 2)) {\n      /* Set sampling factors. */\n      if (++argn >= argc)       /* advance to next argument */\n        usage();\n      samplearg = argv[argn];\n      /* Must delay setting sample factors until after we have processed any\n       * colorspace-determining switches, since jpeg_set_colorspace sets\n       * default sampling factors.\n       */\n\n    } else if (keymatch(arg, \"scans\", 4)) {\n      /* Set scan script. */\n#ifdef C_MULTISCAN_FILES_SUPPORTED\n      if (++argn >= argc)       /* advance to next argument */\n        usage();\n      scansarg = argv[argn];\n      /* We must postpone reading the file in case -progressive appears. */\n#else\n      fprintf(stderr, \"%s: sorry, multi-scan output was not compiled in\\n\",\n              progname);\n      exit(EXIT_FAILURE);\n#endif\n\n    } else if (keymatch(arg, \"smooth\", 2)) {\n      /* Set input smoothing factor. */\n      int val;\n\n      if (++argn >= argc)       /* advance to next argument */\n        usage();\n      if (sscanf(argv[argn], \"%d\", &val) != 1)\n        usage();\n      if (val < 0 || val > 100)\n        usage();\n      cinfo->smoothing_factor = val;\n\n    } else if (keymatch(arg, \"targa\", 1)) {\n      /* Input file is Targa format. */","sourceCodeStart":513,"sourceCodeEnd":549,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/jni/mozjpeg/cjpeg.c#L513-L549","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"# before\ncjpeg -scans myscript.txt input.ppm > out.jpg\n# after (rebuild with C_MULTISCAN_FILES_SUPPORTED, then)\ncjpeg -scans myscript.txt input.ppm > out.jpg\n# or, if you cannot rebuild, omit -scans:\ncjpeg input.ppm > out.jpg","handlingStrategy":"validation","validationCode":"#!/bin/sh\n# Guard before invoking cjpeg with -scans: probe whether this build supports it.\nprintf '' | cjpeg -scans /dev/null 2>/tmp/probe.err >/dev/null\nif grep -q 'multi-scan output was not compiled in' /tmp/probe.err 2>/dev/null; then\n  echo 'ERROR: this cjpeg build lacks multi-scan support; rebuild or drop -scans' >&2\n  exit 1\nfi\ncjpeg -scans script.txt in.ppm > out.jpg","typeGuard":"// n/a: cjpeg is a CLI process, not a typed API. Guard at the shell/script layer.","tryCatchPattern":"# cjpeg calls exit() directly; there is no in-process exception.\n# Wrap as subprocess and check exit code:\nif ! cjpeg -scans script.txt in.ppm > out.jpg 2>cjpeg.err; then\n  if grep -q 'multi-scan output was not compiled in' cjpeg.err; then\n    echo 'rebuild mozjpeg with C_MULTISCAN_FILES_SUPPORTED or drop -scans' >&2\n  fi\n  exit 1\nfi","preventionTips":["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."],"tags":["mozjpeg","cjpeg","build-config","compile-time","multiscan","jpeg"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}