{"record":{"id":"325c93f345a9e9c6","repo":"DrKLO/Telegram","slug":"s-can-t-open-s","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/cjpeg.c","lineNumber":742,"sourceCode":"      if (file_index != argc - 1) {\n        fprintf(stderr, \"%s: must name one input and one output file\\n\",\n                progname);\n        usage();\n      }\n    }\n  }\n#else\n  /* Unix style: expect zero or one file name */\n  if (file_index < argc - 1) {\n    fprintf(stderr, \"%s: only one input file\\n\", progname);\n    usage();\n  }\n#endif /* TWO_FILE_COMMANDLINE */\n\n  /* Open the input file. */\n  if (file_index < argc) {\n    if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) {\n      fprintf(stderr, \"%s: can't open %s\\n\", progname, argv[file_index]);\n      exit(EXIT_FAILURE);\n    }\n  } else {\n    /* default input file is stdin */\n    input_file = read_stdin();\n  }\n\n  /* Open the output file. */\n  if (outfilename != NULL) {\n    if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) {\n      fprintf(stderr, \"%s: can't open %s\\n\", progname, outfilename);\n      exit(EXIT_FAILURE);\n    }\n  } else if (!memdst) {\n    /* default output file is stdout */\n    output_file = write_stdout();\n  }\n","sourceCodeStart":724,"sourceCodeEnd":760,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/jni/mozjpeg/cjpeg.c#L724-L760","documentation":"cjpeg opens the positional input file with fopen(path, READ_BINARY). If fopen returns NULL (file missing, path wrong, permission denied, or unreadable), this message prints and the process exits with EXIT_FAILURE. The %s is the offending input path.","triggerScenarios":"The input file path does not exist, is not readable by the current user, is a directory, or the path is malformed. Triggered when file_index < argc and fopen fails.","commonSituations":"Wrong working directory / relative path; typos in the path; permission issues on mounted volumes or Android storage paths; the file was deleted between staging and invocation; a glob that did not expand.","solutions":["Verify the path exists and is readable: ls -l <path> and test -r <path> before invoking cjpeg.","Use absolute paths to avoid working-directory drift.","Check file permissions and ownership; ensure the invoking process has read access.","Confirm the path is a regular file, not a directory."],"exampleFix":"# before: wrong/missing path\ncjpeg /wrong/dir/in.ppm out.jpg\n# after\ncjpeg \"$(pwd)/in.ppm\" out.jpg","handlingStrategy":"validation","validationCode":"#!/bin/sh\nIN=\"$1\"\n[ -n \"$IN\" ] || { echo 'no input file given' >&2; exit 1; }\n[ -f \"$IN\" ] || { echo \"not a regular file: $IN\" >&2; exit 1; }\n[ -r \"$IN\" ] || { echo \"not readable: $IN\" >&2; exit 1; }\ncjpeg \"$IN\" out.jpg","typeGuard":"// n/a: filesystem precondition check in the caller.","tryCatchPattern":"if ! cjpeg \"$IN\" out.jpg 2>/tmp/e; then\n  grep -q \"can't open\" /tmp/e && { echo \"input file missing/unreadable: $IN\" >&2; ls -l \"$IN\"; exit 1; }\nfi","preventionTips":["Use absolute paths and test -r/-f before invoking cjpeg.","Confirm the working directory in long-running daemons before relative-path calls.","Check storage permissions (especially on Android/external storage) before encoding."],"tags":["mozjpeg","cjpeg","filesystem","fopen","input-file"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}