DrKLO/Telegram · error
%s: missing argument for dc-scan-opt
Error message
%s: missing argument for dc-scan-opt
What it means
The -dc-scan-opt switch requires a following integer argument (the DC scan optimization mode, passed to jpeg_c_set_int_param with JINT_DC_SCAN_OPT_MODE via atoi). cjpeg finds no token after -dc-scan-opt, prints this message, and calls usage() which exits.
Source
Thrown at TMessagesProj/jni/mozjpeg/cjpeg.c:404
usage();
icc_filename = argv[argn];
} else if (keymatch(arg, "maxmemory", 3)) {
/* Maximum memory in Kb (or Mb with 'm'). */
long lval;
char ch = 'x';
if (++argn >= argc) /* advance to next argument */
usage();
if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1)
usage();
if (ch == 'm' || ch == 'M')
lval *= 1000L;
cinfo->mem->max_memory_to_use = lval * 1000L;
} else if (keymatch(arg, "dc-scan-opt", 3)) {
if (++argn >= argc) { /* advance to next argument */
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);View on GitHub (pinned to 45ab8f4308)
Solutions
- Supply an integer mode value, e.g. `cjpeg -dc-scan-opt 1 ...`.
- Ensure the variable holding the mode is non-empty before invoking cjpeg.
Example fix
# before cjpeg -dc-scan-opt in.ppm > out.jpg # after cjpeg -dc-scan-opt 1 in.ppm > out.jpg
Defensive patterns
Strategy: validation
Validate before calling
# Ensure -dc-scan-opt has a non-empty integer argument. case "$DCSCAN" in ''|*[!0-9-]*) DCSCAN=1 ;; esac cjpeg -dc-scan-opt "$DCSCAN" in.ppm > out.jpg
Prevention
- Always pass an integer after -dc-scan-opt.
- Default the mode variable to a sane value.
When it happens
Trigger: Running `cjpeg -dc-scan-opt` with no value following, or as the last token.
Common situations: Truncated command line; a shell variable for the mode that expanded to nothing.
Related errors
- %s: missing argument for dct
- %s: invalid argument for dct
- %s: missing argument for outfile
- %s: missing argument for quality
- %s: %d is invalid argument for quant-table
AI-assisted analysis of DrKLO/Telegram@45ab8f4308 (2026-08-14).
Data as JSON: /api/errors/adaa786f94df20b4.
Report an issue: GitHub.