DrKLO/Telegram · error
Required arguments:\n
Error message
Required arguments:\n
What it means
yuvjpeg is a mozjpeg CLI that converts a raw 4:2:0 YUV file to JPEG. main() requires exactly 5 argv elements (program + 4 args: quality, size, YUV in, JPG out). If argc != 5 it prints the usage header `Required arguments:` to stderr and returns 1. The subsequent fprintf lines (errors 192-194) are the argument descriptions printed as part of the same usage block.
Source
Thrown at TMessagesProj/jni/mozjpeg/yuvjpeg.c:117
int frame_width;
int frame_height;
const char *yuv_path;
const char *jpg_path;
FILE *yuv_fd;
size_t yuv_size;
unsigned char *yuv_buffer;
JSAMPLE *jpg_buffer;
struct jpeg_compress_struct cinfo;
struct jpeg_error_mgr jerr;
FILE *jpg_fd;
JSAMPROW yrow_pointer[16];
JSAMPROW cbrow_pointer[8];
JSAMPROW crrow_pointer[8];
JSAMPROW *plane_pointer[3];
int y;
if (argc != 5) {
fprintf(stderr, "Required arguments:\n");
fprintf(stderr, "1. JPEG quality value, 0-100\n");
fprintf(stderr, "2. Image size (e.g. '512x512')\n");
fprintf(stderr, "3. Path to YUV input file\n");
fprintf(stderr, "4. Path to JPG output file\n");
return 1;
}
errno = 0;
quality = strtol(argv[1], NULL, 10);
if (errno != 0 || quality < 0 || quality > 100) {
fprintf(stderr, "Invalid JPEG quality value!\n");
return 1;
}
matches = sscanf(argv[2], "%dx%d", &luma_width, &luma_height);
if (matches != 2) {
fprintf(stderr, "Invalid image size input!\n");View on GitHub (pinned to 45ab8f4308)
Solutions
- Invoke as: yuvjpeg <quality 0-100> <WxH> <yuv_in> <jpg_out>.
- Validate argc == 5 in the calling script before exec.
- Double-check that no extra/blank arguments are appended.
Example fix
// before yuvjpeg 90 512x512 in.yuv // after yuvjpeg 90 512x512 in.yuv out.jpg
Defensive patterns
Strategy: validation
Validate before calling
/* yuvjpeg needs exactly 4 args: quality, size, yuv_in, jpg_out */
if (argc != 5) {
fprintf(stderr, "usage: %s <quality 0-100> <WxH> <yuv_in> <jpg_out>\n", argv[0]);
return 1;
} Prevention
- Wrap yuvjpeg invocations and assert argument count == 4 before exec.
- Keep a documented usage string in the calling script.
- Reject empty/blank arguments upstream.
When it happens
Trigger: Invoking yuvjpeg with any number of arguments other than 4 (too few or too many).
Common situations: Missing the size or output argument, passing flags yuvjpeg does not understand, or a wrapper script miscounting arguments.
Related errors
- %s: must name one input and one output file\n
- %s: only one input file\n
- 1. JPEG quality value, 0-100\n
- 2. Image size (e.g. '512x512')\n
- 3. Path to YUV input file\n
AI-assisted analysis of DrKLO/Telegram@45ab8f4308 (2026-08-14).
Data as JSON: /api/errors/7c9e991d14f70ead.
Report an issue: GitHub.