{"record":{"id":"09bccb6d7d10f172","repo":"DrKLO/Telegram","slug":"error-opening-s-n","errorCode":null,"errorMessage":"Error opening '%s'.\\n","messagePattern":"Error opening '(.+?)'\\.\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"TMessagesProj/jni/opus/src/opus_compare.c","lineNumber":221,"sourceCode":"    rate=atoi(_argv[2]);\n    if(rate!=8000&&rate!=12000&&rate!=16000&&rate!=24000&&rate!=48000){\n      fprintf(stderr,\n       \"Sampling rate must be 8000, 12000, 16000, 24000, or 48000\\n\");\n      return EXIT_FAILURE;\n    }\n    downsample=48000/rate;\n    switch(rate){\n      case  8000:ybands=13;break;\n      case 12000:ybands=15;break;\n      case 16000:ybands=17;break;\n      case 24000:ybands=19;break;\n    }\n    yfreqs=NFREQS/downsample;\n    _argv+=2;\n  }\n  fin1=fopen(_argv[1],\"rb\");\n  if(fin1==NULL){\n    fprintf(stderr,\"Error opening '%s'.\\n\",_argv[1]);\n    return EXIT_FAILURE;\n  }\n  fin2=fopen(_argv[2],\"rb\");\n  if(fin2==NULL){\n    fprintf(stderr,\"Error opening '%s'.\\n\",_argv[2]);\n    fclose(fin1);\n    return EXIT_FAILURE;\n  }\n  /*Read in the data and allocate scratch space.*/\n  xlength=read_pcm16(&x,fin1,2);\n  if(nchannels==1){\n    for(xi=0;xi<xlength;xi++)x[xi]=.5*(x[2*xi]+x[2*xi+1]);\n  }\n  fclose(fin1);\n  ylength=read_pcm16(&y,fin2,nchannels);\n  fclose(fin2);\n  if(xlength!=ylength*downsample){\n    fprintf(stderr,\"Sample counts do not match (%lu!=%lu).\\n\",","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/jni/opus/src/opus_compare.c#L203-L239","documentation":"fopen(_argv[1], \"rb\") for the first input file (fin1) returned NULL. opus_compare cannot open the first .sw file for reading and exits before touching the second file.","triggerScenarios":"The first file path does not exist, is unreadable, or is a directory. After optional -s/-r parsing, _argv[1] is the first non-option argument (the first .sw file).","commonSituations":"Typo in filename; wrong working directory; file needs a permission not granted; the -s/-r flags consumed the real filename because of misordered arguments.","solutions":["Verify the first file path exists and is readable (access/stat).","Use an absolute path.","Make sure flags (-s, -r rate) come before the two file paths so _argv[1] lands on the actual file."],"exampleFix":"// before\n./opus_compare -r 48000 missing1.sw file2.sw\n\n// after\n./opus_compare -r 48000 /abs/path/file1.sw file2.sw","handlingStrategy":"validation","validationCode":"// Check the first file is readable before fopen.\nif (access(_argv[1], R_OK) != 0) {\n    fprintf(stderr, \"Error opening '%s'.\\n\", _argv[1]);\n    return EXIT_FAILURE;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use absolute paths for the first file.","Put -s/-r flags before the files so _argv[1] is the real filename.","Confirm the file exists with stat/access before running."],"tags":["io","file-read","opus","opus-compare","cli","c"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}