DrKLO/Telegram · error
-merge parameter must be at least 1.\n
Error message
-merge parameter must be at least 1.\n
What it means
The -merge option takes an integer argument specifying how many consecutive Opus packets to concatenate via opus_repacketizer_cat before emitting output. The value is parsed with atoi(), which returns 0 for non-numeric strings. A merge value of 0 or negative is rejected because merging zero packets is meaningless. The parsed value is used directly as nb_packets in the read loop at line 119.
Source
Thrown at TMessagesProj/jni/opus/src/repacketizer_demo.c:81
int len[48];
int rng[48];
OpusRepacketizer *rp;
unsigned char output_packet[MAX_PACKETOUT];
int merge = 1, split=0;
if (argc < 3)
{
usage(argv[0]);
return EXIT_FAILURE;
}
for (i=1;i<argc-2;i++)
{
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");View on GitHub (pinned to 45ab8f4308)
Solutions
- Pass a positive integer: `-merge 2` or higher (up to 48).
- If unsure of the value, omit -merge entirely — it defaults to 1 (line 67).
Example fix
// before repacketizer_demo -merge 0 in.oct out.oct // after repacketizer_demo -merge 2 in.oct out.oct
Defensive patterns
Strategy: validation
Validate before calling
// Validate merge value before passing to repacketizer logic
int merge = atoi(arg);
if (merge < 1) {
fprintf(stderr, "-merge parameter must be at least 1.\n");
return EXIT_FAILURE;
} Prevention
- Validate user-supplied integer arguments with strtol and check errno for overflow.
- Default to merge=1 when no -merge flag is given (the tool already does this at line 67).
When it happens
Trigger: Passing `-merge 0`, `-merge -5`, or `-merge abc` (atoi returns 0). The check at line 79 fires when merge < 1.
Common situations: Typo in the numeric argument; passing a variable that expanded to empty; shell quoting that dropped the number leaving the next token as a separate unrecognized option.
Related errors
- usage: %s [options] input_file output_file\n
- -merge parameter must be less than 48.\n
- Unknown option: %s\n
- Error opening input file: %s\n
- Error opening output file: %s\n
AI-assisted analysis of DrKLO/Telegram@45ab8f4308 (2026-08-14).
Data as JSON: /api/errors/c8a74d8a95c7701e.
Report an issue: GitHub.