{"record":{"id":"7b958bb4288cc718","repo":"DrKLO/Telegram","slug":"s-unknown-option-s","errorCode":null,"errorMessage":"%s: unknown option '%s'\n","messagePattern":"(.+?): unknown option '(.+?)'\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"TMessagesProj/jni/mozjpeg/cjpeg.c","lineNumber":605,"sourceCode":"      jpeg_c_set_float_param(cinfo, JFLOAT_LAMBDA_LOG_SCALE1, 12.0);\n      jpeg_c_set_float_param(cinfo, JFLOAT_LAMBDA_LOG_SCALE2, 13.0);\n      jpeg_c_set_bool_param(cinfo, JBOOLEAN_USE_LAMBDA_WEIGHT_TBL, TRUE);\n      jpeg_set_quality(cinfo, 75, TRUE);\n      \n    } else if (keymatch(arg, \"tune-hvs-psnr\", 6)) {\n      jpeg_c_set_int_param(cinfo, JINT_BASE_QUANT_TBL_IDX, 3);\n      jpeg_c_set_float_param(cinfo, JFLOAT_LAMBDA_LOG_SCALE1, 14.75);\n      jpeg_c_set_float_param(cinfo, JFLOAT_LAMBDA_LOG_SCALE2, 16.5);\n      jpeg_c_set_bool_param(cinfo, JBOOLEAN_USE_LAMBDA_WEIGHT_TBL, TRUE);\n      jpeg_set_quality(cinfo, 75, TRUE);\n\n    } else if (keymatch(arg, \"noovershoot\", 11)) {\n      jpeg_c_set_bool_param(cinfo, JBOOLEAN_OVERSHOOT_DERINGING, FALSE);\n\n\t} else if (keymatch(arg, \"nojfif\", 6)) {\n      cinfo->write_JFIF_header = 0;\n    } else {\n      fprintf(stderr, \"%s: unknown option '%s'\\n\", progname, arg);\n      usage();                  /* bogus switch */\n    }\n  }\n\n  /* Post-switch-scanning cleanup */\n\n  if (for_real) {\n\n    /* Set quantization tables for selected quality. */\n    /* Some or all may be overridden if -qtables is present. */\n    if (qualityarg != NULL)     /* process -quality if it was present */\n      if (! set_quality_ratings(cinfo, qualityarg, force_baseline)) {\n        fprintf(stderr, \"%s: can't set quality ratings\\n\", progname);\n        usage();\n      }\n\n    if (qtablefile != NULL)     /* process -qtables if it was present */\n      if (! read_quant_tables(cinfo, qtablefile, force_baseline)) {","sourceCodeStart":587,"sourceCodeEnd":623,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/jni/mozjpeg/cjpeg.c#L587-L623","documentation":"After every recognized keymatch branch fails to match the current argument, cjpeg falls into the final else and reports the unrecognized switch, then calls usage() (which exits non-zero). This catches typos, deprecated flags, and flags that belong to djpeg rather than cjpeg.","triggerScenarios":"Passing any switch that is not in cjpeg's parse_switches table (e.g. -grayscale meant for djpeg, a misspelled flag like -qualty, or a mozjpeg flag removed/renamed in this version). Note keymatch matches by minimum prefix length, so a too-short ambiguous prefix can also miss.","commonSituations":"Mixing up cjpeg and djpeg/ffmpeg flags; using a flag from a newer/older mozjpeg version; typos in hand-typed or templated command lines; expecting an option that exists in libjpeg-turbo but not mozjpeg or vice versa.","solutions":["Run cjpeg with no args or -h to print the full usage() list of supported switches for this exact build.","Check the spelling and minimum prefix length required by keymatch (e.g. -quality needs at least -qua).","Confirm the flag is valid for cjpeg specifically (not a djpeg-only or jpegtran-only option).","If you need an option that this build lacks, rebuild mozjpeg with the relevant feature macro enabled."],"exampleFix":"# before\ncjpeg -grayscale input.ppm > out.jpg   # -grayscale is not a cjpeg switch\n# after\ncjpeg -grayscale input.rgb > out.jpg   # verify via 'cjpeg -h'; use the documented input-type or colorspace flag instead","handlingStrategy":"validation","validationCode":"#!/bin/sh\n# Reject unknown switches before calling cjpeg\nSUPPORTED='quality qtables qslots sample scans outfile icc optimize progressive'\nfor a in \"$@\"; do\n  case \"$a\" in -*)\n    opt=${a#-}\n    if ! printf '%s\\n' \"$SUPPORTED\" | grep -qw -- \"$opt\"; then\n      echo \"unknown switch: $a\" >&2; exit 1\n    fi;; esac\ndone\ncjpeg \"$@\"","typeGuard":"// n/a: validate against the tool's documented switch set at the shell layer.","tryCatchPattern":"if ! cjpeg \"$@\" 2>/tmp/e; then\n  if grep -q 'unknown option' /tmp/e; then\n    cjpeg 2>&1 | sed -n '/usage/,/^$/p'   # show supported switches\n  fi\n  exit 1\nfi","preventionTips":["Canonicalize command construction from a single option-registry/map in your code.","Run cjpeg with no args in a smoke test to capture the supported switch list for the deployed version.","Avoid passing djpeg/ffmpeg flags to cjpeg; keep encoder/decoder arg sets separate."],"tags":["mozjpeg","cjpeg","cli-argument","unknown-option","usage"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}