DrKLO/Telegram · error

%s: missing argument for dct

Error message

%s: missing argument for dct

What it means

The -dct switch requires a following argument selecting the DCT algorithm (int, fast, or float). cjpeg increments the argument index and finds it has run past argc (no token after -dct); it prints this message and calls usage() which exits. This is a command-line usage error, not a build issue.

Source

Thrown at TMessagesProj/jni/mozjpeg/cjpeg.c:326

      cinfo->optimize_coding = FALSE;
#else
      fprintf(stderr, "%s: sorry, arithmetic coding not supported\n",
              progname);
      exit(EXIT_FAILURE);
#endif

    } else if (keymatch(arg, "baseline", 1)) {
      /* Force baseline-compatible output (8-bit quantizer values). */
      force_baseline = TRUE;
      /* Disable multiple scans */
      simple_progressive = FALSE;
      cinfo->num_scans = 0;
      cinfo->scan_info = NULL;

    } else if (keymatch(arg, "dct", 2)) {
      /* Select DCT algorithm. */
      if (++argn >= argc) {      /* advance to next argument */
        fprintf(stderr, "%s: missing argument for dct\n", progname);
        usage();
      }
      if (keymatch(argv[argn], "int", 1)) {
        cinfo->dct_method = JDCT_ISLOW;
      } else if (keymatch(argv[argn], "fast", 2)) {
        cinfo->dct_method = JDCT_IFAST;
      } else if (keymatch(argv[argn], "float", 2)) {
        cinfo->dct_method = JDCT_FLOAT;
      } else {
        fprintf(stderr, "%s: invalid argument for dct\n", progname);
        usage();
      }

    } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) {
      /* Enable debug printouts. */
      /* On first -d, print version identification */
      static boolean printed_version = FALSE;

View on GitHub (pinned to 45ab8f4308)

Solutions

  1. Supply one of the accepted values: `-dct int`, `-dct fast`, or `-dct float`.
  2. Quote/expand shell variables so the DCT method token is actually present.

Example fix

# before
cjpeg -dct in.ppm > out.jpg

# after
cjpeg -dct fast in.ppm > out.jpg
Defensive patterns

Strategy: validation

Validate before calling

# Ensure -dct is always followed by a value before invoking cjpeg.
case "$DCT" in int|fast|float) : ;; *) DCT=int ;; esac
cjpeg -dct "$DCT" in.ppm > out.jpg

Prevention

When it happens

Trigger: Running `cjpeg -dct` as the last token on the command line, with no value following.

Common situations: Truncated command lines in shell scripts; a variable that was meant to expand to the DCT method but expanded to empty/nothing.

Related errors


AI-assisted analysis of DrKLO/Telegram@45ab8f4308 (2026-08-14). Data as JSON: /api/errors/7a5931cf49d3b695. Report an issue: GitHub.