{"record":{"id":"57bc379aab0e35f2","repo":"DrKLO/Telegram","slug":"s-can-t-open-s-57bc37","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/rdjpgcom.c","lineNumber":487,"sourceCode":"      break;                    /* not switch, must be file name */\n    arg++;                      /* advance over '-' */\n    if (keymatch(arg, \"verbose\", 1)) {\n      verbose++;\n    } else if (keymatch(arg, \"raw\", 1)) {\n      raw = 1;\n    } else\n      usage();\n  }\n\n  /* Open the input file. */\n  /* Unix style: expect zero or one file name */\n  if (argn < argc - 1) {\n    fprintf(stderr, \"%s: only one input file\\n\", progname);\n    usage();\n  }\n  if (argn < argc) {\n    if ((infile = fopen(argv[argn], READ_BINARY)) == NULL) {\n      fprintf(stderr, \"%s: can't open %s\\n\", progname, argv[argn]);\n      exit(EXIT_FAILURE);\n    }\n  } else {\n    /* default input file is stdin */\n#ifdef USE_SETMODE              /* need to hack file mode? */\n    setmode(fileno(stdin), O_BINARY);\n#endif\n#ifdef USE_FDOPEN               /* need to re-open in binary mode? */\n    if ((infile = fdopen(fileno(stdin), READ_BINARY)) == NULL) {\n      fprintf(stderr, \"%s: can't open stdin\\n\", progname);\n      exit(EXIT_FAILURE);\n    }\n#else\n    infile = stdin;\n#endif\n  }\n\n  /* Scan the JPEG headers. */","sourceCodeStart":469,"sourceCodeEnd":505,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/jni/mozjpeg/rdjpgcom.c#L469-L505","documentation":"rdjpgcom attempts to fopen the user-specified input file in binary read mode (READ_BINARY). If fopen returns NULL, the file could not be opened -- typically because it does not exist, permissions are insufficient, or the path is a directory. The program prints this error with the file path and exits with EXIT_FAILURE.","triggerScenarios":"Passing a file path that does not exist; a path with insufficient read permissions; a path that is a directory rather than a file; a path with incorrect escaping or quoting in the shell.","commonSituations":"Typo in the filename; relative path used from the wrong working directory; file on an unmounted or disconnected volume; file owned by another user with no read access; Android environment where the path is in a protected directory.","solutions":["Verify the file exists and is readable: ls -la <path> or test -r <path>.","Check the full path for typos and correct relative/absolute path usage.","Fix file permissions: chmod +r <path> or ensure the running user has access.","If the path is a directory, remove it or pass the actual file path."],"exampleFix":"# before\nrdjpgcom /wrong/path/image.jpg\n# after\nrdjpgcom ./images/image.jpg","handlingStrategy":"validation","validationCode":"# Check file exists and is readable before invoking rdjpgcom\nif [ ! -r \"$input\" ]; then\n  echo \"Error: cannot read $input\" >&2\n  exit 1\nfi\nrdjpgcom \"$input\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use test -r <path> to verify readability before passing to CLI tools.","Use absolute paths to avoid working-directory ambiguity.","Check file permissions with ls -la when debugging access errors."],"tags":["filesystem","file-not-found","cli","mozjpeg"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}