DrKLO/Telegram · error

%s: missing argument for outfile

Error message

%s: missing argument for outfile

What it means

The -outfile switch requires a following argument giving the output file path. cjpeg finds no token after -outfile, prints this message, and calls usage() which exits. (Compare: outfilename is then saved for later use; without it there is no destination.)

Source

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

        fprintf(stderr, "%s: missing argument for dc-scan-opt\n", progname);
        usage();
      }
      jpeg_c_set_int_param(cinfo, JINT_DC_SCAN_OPT_MODE, atoi(argv[argn]));

    } else if (keymatch(arg, "optimize", 1) || keymatch(arg, "optimise", 1)) {
      /* Enable entropy parm optimization. */
#ifdef ENTROPY_OPT_SUPPORTED
      cinfo->optimize_coding = TRUE;
#else
      fprintf(stderr, "%s: sorry, entropy optimization was not compiled in\n",
              progname);
      exit(EXIT_FAILURE);
#endif

    } else if (keymatch(arg, "outfile", 4)) {
      /* Set output file name. */
      if (++argn >= argc) {      /* advance to next argument */
        fprintf(stderr, "%s: missing argument for outfile\n", progname);
        usage();
      }
      outfilename = argv[argn]; /* save it away for later use */

    } else if (keymatch(arg, "progressive", 1)) {
      /* Select simple progressive mode. */
#ifdef C_PROGRESSIVE_SUPPORTED
      simple_progressive = TRUE;
      /* We must postpone execution until num_components is known. */
#else
      fprintf(stderr, "%s: sorry, progressive output was not compiled in\n",
              progname);
      exit(EXIT_FAILURE);
#endif

    } else if (keymatch(arg, "memdst", 2)) {
      /* Use in-memory destination manager */
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)

View on GitHub (pinned to 45ab8f4308)

Solutions

  1. Supply a path: `cjpeg -outfile out.jpg in.ppm`.
  2. Or omit -outfile and use shell redirection (`cjpeg in.ppm > out.jpg`).
  3. Make sure the variable expanding to the path is non-empty.

Example fix

# before
cjpeg -outfile in.ppm

# after
cjpeg -outfile out.jpg in.ppm
Defensive patterns

Strategy: validation

Validate before calling

# Make sure -outfile has a non-empty path, or omit it and use redirection.
if [ -z "$OUTFILE" ]; then
  cjpeg in.ppm > out.jpg
else
  cjpeg -outfile "$OUTFILE" in.ppm
fi

Prevention

When it happens

Trigger: Running `cjpeg -outfile` with no path following, or as the last token.

Common situations: Truncated command line; an empty shell variable for the output path; redirection-based usage where -outfile was added by mistake.

Related errors


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