DrKLO/Telegram · error
%s: only one input file\n
Error message
%s: only one input file\n
What it means
When djpeg is built WITHOUT TWO_FILE_COMMANDLINE (Unix single-file style), it accepts at most one positional input (output goes to stdout). If file_index < argc-1 there is more than one positional file, this message prints, and usage() exits.
Source
Thrown at TMessagesProj/jni/mozjpeg/djpeg.c:579
/* Must have either -outfile switch or explicit output file name */
if (outfilename == NULL) {
if (file_index != argc - 2) {
fprintf(stderr, "%s: must name one input and one output file\n",
progname);
usage();
}
outfilename = argv[file_index + 1];
} else {
if (file_index != argc - 1) {
fprintf(stderr, "%s: must name one input and one output file\n",
progname);
usage();
}
}
#else
/* Unix style: expect zero or one file name */
if (file_index < argc - 1) {
fprintf(stderr, "%s: only one input file\n", progname);
usage();
}
#endif /* TWO_FILE_COMMANDLINE */
/* Open the input file. */
if (file_index < argc) {
if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) {
fprintf(stderr, "%s: can't open %s\n", progname, argv[file_index]);
exit(EXIT_FAILURE);
}
} else {
/* default input file is stdin */
input_file = read_stdin();
}
/* Open the output file. */
if (outfilename != NULL) {
if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) {View on GitHub (pinned to 45ab8f4308)
Solutions
- Pass at most one positional input and redirect stdout: djpeg in.jpg > out.ppm.
- If two-positional semantics are required, rebuild with TWO_FILE_COMMANDLINE defined or use -outfile.
- Collapse globs/loops to a single input per invocation.
Example fix
# before: two positionals on a Unix-style build djpeg in.jpg out.ppm # after djpeg in.jpg > out.ppm
Defensive patterns
Strategy: validation
Validate before calling
#!/bin/sh
pos=()
for a in "$@"; do case "$a" in -*) ;; *) pos+=("$a");; esac; done
[ "${#pos[@]}" -gt 1 ] && { echo 'this djpeg build accepts at most one input; redirect stdout for output' >&2; exit 1; }
djpeg "$@" Type guard
// n/a: argv-count validation in the caller.
Try / catch
if ! djpeg "$@" 2>/tmp/e; then
grep -q 'only one input file' /tmp/e && { echo 'Unix-style build: use one input + stdout redirect'; exit 1; }
fi Prevention
- Know and document your djpeg build's commandline style.
- Prefer stdout redirection (djpeg in.jpg > out.ppm) for portability.
- Loop over multiple inputs instead of passing several at once.
When it happens
Trigger: Running a non-TWO_FILE_COMMANDLINE build of djpeg with two or more positional file arguments.
Common situations: Moving from a TWO_FILE_COMMANDLINE build to a Unix-style build while keeping the old two-positional invocation; shell glob producing multiple inputs; wrapper scripts that always append an output path.
Related errors
- %s: only one input file
- %s: must name one input and one output file
- %s: must name one input and one output file\n
- %s: must name one input and one output file
- %s: missing argument for trellis-dc-ver-weight
AI-assisted analysis of DrKLO/Telegram@45ab8f4308 (2026-08-14).
Data as JSON: /api/errors/43b1f4dbc8d0510d.
Report an issue: GitHub.