{"record":{"id":"041b7f8cc4078459","repo":"DrKLO/Telegram","slug":"s-can-t-open-s-041b7f","errorCode":null,"errorMessage":"%s: can't open %s\n","messagePattern":"(.+?): can't open (.+?)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"TMessagesProj/jni/mozjpeg/djpeg.c","lineNumber":330,"sourceCode":"      cinfo->out_color_space = JCS_RGB565;\n\n    } else if (keymatch(arg, \"icc\", 1)) {\n      /* Set ICC filename. */\n      if (++argn >= argc)       /* advance to next argument */\n        usage();\n      icc_filename = argv[argn];\n      jpeg_save_markers(cinfo, JPEG_APP0 + 2, 0xFFFF);\n\n    } else if (keymatch(arg, \"map\", 3)) {\n      /* Quantize to a color map taken from an input file. */\n      if (++argn >= argc)       /* advance to next argument */\n        usage();\n      if (for_real) {           /* too expensive to do twice! */\n#ifdef QUANT_2PASS_SUPPORTED    /* otherwise can't quantize to supplied map */\n        FILE *mapfile;\n\n        if ((mapfile = fopen(argv[argn], READ_BINARY)) == NULL) {\n          fprintf(stderr, \"%s: can't open %s\\n\", progname, argv[argn]);\n          exit(EXIT_FAILURE);\n        }\n        read_color_map(cinfo, mapfile);\n        fclose(mapfile);\n        cinfo->quantize_colors = TRUE;\n#else\n        ERREXIT(cinfo, JERR_NOT_COMPILED);\n#endif\n      }\n\n    } else if (keymatch(arg, \"maxmemory\", 3)) {\n      /* Maximum memory in Kb (or Mb with 'm'). */\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)","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/jni/mozjpeg/djpeg.c#L312-L348","documentation":"djpeg's -map switch loads an external color map (for color quantization) from a file. Under QUANT_2PASS_SUPPORTED it opens the file with fopen(path, READ_BINARY); if fopen returns NULL it prints this message and exits EXIT_FAILURE. The %s is the map file path.","triggerScenarios":"Passing -map <file> (only honored when for_real is true) where the map file does not exist, is unreadable, or is a directory.","commonSituations":"Wrong/relative map file path; missing colormap asset; permission issues; passing a PPM/JPEG by mistake instead of a colormap file expected by read_color_map.","solutions":["Verify the map file exists and is readable before invoking djpeg.","Use an absolute path and confirm the file is in the format read_color_map expects.","If you do not need color quantization to a supplied map, drop the -map switch and let djpeg compute one with -colors / -onepass / -two_pass."],"exampleFix":"# before: map path missing\ndjpeg -map /wrong/colormap in.jpg out.ppm\n# after\ndjpeg -map \"$(pwd)/colormap.map\" in.jpg out.ppm","handlingStrategy":"validation","validationCode":"#!/bin/sh\nMAP=\"$1\"\n[ -f \"$MAP\" ] && [ -r \"$MAP\" ] || { echo \"map file missing/unreadable: $MAP\" >&2; exit 1; }\ndjpeg -map \"$MAP\" in.jpg out.ppm  # requires QUANT_2PASS_SUPPORTED in this build","typeGuard":"// n/a: filesystem precondition check in the caller.","tryCatchPattern":"if ! djpeg -map \"$MAP\" in.jpg out.ppm 2>/tmp/e; then\n  grep -q \"can't open\" /tmp/e && { echo \"map file missing/unreadable: $MAP\" >&2; exit 1; }\nfi","preventionTips":["Verify the colormap file exists and is readable before invoking djpeg.","Confirm the file format matches what read_color_map expects.","Keep colormap assets under version control with stable paths."],"tags":["mozjpeg","djpeg","filesystem","fopen","colormap"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}