{"record":{"id":"ec029b1631fd6c8f","repo":"DrKLO/Telegram","slug":"s-d-is-invalid-argument-for-quant-table","errorCode":null,"errorMessage":"%s: %d is invalid argument for quant-table\n","messagePattern":"(.+?): (.+?) is invalid argument for quant-table\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"TMessagesProj/jni/mozjpeg/cjpeg.c","lineNumber":480,"sourceCode":"       * colorspace-determining switches, since jpeg_set_colorspace sets\n       * default quant table numbers.\n       */\n\n    } else if (keymatch(arg, \"qtables\", 2)) {\n      /* Quantization tables fetched from file. */\n      if (++argn >= argc)       /* advance to next argument */\n        usage();\n      qtablefile = argv[argn];\n      /* We postpone actually reading the file in case -quality comes later. */\n\n    } else if (keymatch(arg, \"quant-table\", 7)) {\n      int val;\n      if (++argn >= argc)       /* advance to next argument */\n        usage();\n      val = atoi(argv[argn]);\n      jpeg_c_set_int_param(cinfo, JINT_BASE_QUANT_TBL_IDX, val);\n      if (jpeg_c_get_int_param(cinfo, JINT_BASE_QUANT_TBL_IDX) != val) {\n        fprintf(stderr, \"%s: %d is invalid argument for quant-table\\n\", progname, val);\n        usage();\n      }\n      jpeg_set_quality(cinfo, 75, TRUE);\n\n    } else if (keymatch(arg, \"quant-baseline\", 7)) {\n      /* Force quantization table to meet baseline requirements */\n      force_baseline = TRUE;\n    \n    } else if (keymatch(arg, \"restart\", 1)) {\n      /* Restart interval in MCU rows (or in MCUs with 'b'). */\n      long lval;\n      char ch = 'x';\n\n      if (++argn >= argc)       /* advance to next argument */\n        usage();\n      if (sscanf(argv[argn], \"%ld%c\", &lval, &ch) < 1)\n        usage();\n      if (lval < 0 || lval > 65535L)","sourceCodeStart":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/jni/mozjpeg/cjpeg.c#L462-L498","documentation":"The -quant-table switch selects a base quantization table index via jpeg_c_set_int_param(JINT_BASE_QUANT_TBL_IDX, val). cjpeg then reads it back with jpeg_c_get_int_param; if the value round-trips to something different, the index was out of range / rejected, so cjpeg prints this (with the offending integer) and calls usage() which exits.","triggerScenarios":"Running e.g. `cjpeg -quant-table 9 ...` where only a small set of indices (the built-in quantization tables, typically 0..3 in mozjpeg's tune presets) are valid.","commonSituations":"Passing an index larger than the available base quant tables; assuming 1-based vs 0-based numbering; copy-pasting an index from a different mozjpeg version.","solutions":["Use a valid base quantization table index (check the mozjpeg tune presets: 0, 1, 3 are referenced by -tune-psnr/-tune-ssim/-tune-ms-ssim/-tune-hvs-psnr).","Run `cjpeg -h` or consult the mozjpeg docs to list the valid indices for your build."],"exampleFix":"# before\ncjpeg -quant-table 9 in.ppm > out.jpg\n\n# after\ncjpeg -quant-table 1 in.ppm > out.jpg","handlingStrategy":"validation","validationCode":"# Restrict -quant-table to indices known to this mozjpeg build.\ncase \"$QTBL\" in\n  0|1|3) ;;\n  *) echo \"invalid quant-table: $QTBL (valid: 0,1,3)\" >&2; exit 2 ;;\nesac\ncjpeg -quant-table \"$QTBL\" in.ppm > out.jpg","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only the base quantization-table indices your mozjpeg build provides (see tune presets: 0, 1, 3).","Verify the value round-trips via jpeg_c_get_int_param before relying on it."],"tags":["mozjpeg","cjpeg","cli","argument","jpeg"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}