DrKLO/Telegram · error

Unknown option: %s\n

Error message

Unknown option: %s\n

What it means

While iterating over arguments between position 1 and argc-2 (the option zone), the tool encountered a token that is not -merge, -split, or recognized by any branch. The else clause at line 92 prints the unknown option, calls usage(), and exits. This catch-all ensures no silent misinterpretation of arguments.

Source

Thrown at TMessagesProj/jni/opus/src/repacketizer_demo.c:94

      if (strcmp(argv[i], "-merge")==0)
      {
         merge = atoi(argv[i+1]);
         if(merge<1)
         {
            fprintf(stderr, "-merge parameter must be at least 1.\n");
            return EXIT_FAILURE;
         }
         if(merge>48)
         {
            fprintf(stderr, "-merge parameter must be less than 48.\n");
            return EXIT_FAILURE;
         }
         i++;
      } else if (strcmp(argv[i], "-split")==0)
         split = 1;
      else
      {
         fprintf(stderr, "Unknown option: %s\n", argv[i]);
         usage(argv[0]);
         return EXIT_FAILURE;
      }
   }
   fin = fopen(argv[argc-2], "r");
   if(fin==NULL)
   {
     fprintf(stderr, "Error opening input file: %s\n", argv[argc-2]);
     return EXIT_FAILURE;
   }
   fout = fopen(argv[argc-1], "w");
   if(fout==NULL)
   {
     fprintf(stderr, "Error opening output file: %s\n", argv[argc-1]);
     fclose(fin);
     return EXIT_FAILURE;
   }

View on GitHub (pinned to 45ab8f4308)

Solutions

  1. Review the supported options: -merge <N> and -split are the only flags.
  2. Ensure all options precede the two positional file arguments.
  3. Check for typos in flag names.

Example fix

// before
repacketizer_demo -merg 4 in.oct out.oct
// after
repacketizer_demo -merge 4 in.oct out.oct
Defensive patterns

Strategy: validation

Validate before calling

// Whitelist known options
if (strcmp(argv[i], "-merge") != 0 && strcmp(argv[i], "-split") != 0) {
    fprintf(stderr, "Unknown option: %s\n", argv[i]);
    return EXIT_FAILURE;
}

Prevention

When it happens

Trigger: Passing a misspelled flag like -merg, -splt, or -output; passing an option after the two positional file arguments (where it is treated as an unknown option because the loop only covers argv[1..argc-3]); passing a flag that belongs to a different Opus tool.

Common situations: Confusing repacketizer_demo options with opus_demo or opusenc options; shell auto-expansion producing unexpected tokens; typos.

Related errors


AI-assisted analysis of DrKLO/Telegram@45ab8f4308 (2026-08-14). Data as JSON: /api/errors/153dfda8df12eb4c. Report an issue: GitHub.