{"record":{"id":"49bdadfcc83916e5","repo":"DrKLO/Telegram","slug":"s-must-name-one-input-and-one-output-file-49bdad","errorCode":null,"errorMessage":"%s: must name one input and one output file\n","messagePattern":"(.+?): must name one input and one output file\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"TMessagesProj/jni/mozjpeg/djpeg.c","lineNumber":564,"sourceCode":"   */\n  jpeg_set_marker_processor(&cinfo, JPEG_COM, print_text_marker);\n  jpeg_set_marker_processor(&cinfo, JPEG_APP0 + 12, print_text_marker);\n\n  /* Scan command line to find file names. */\n  /* It is convenient to use just one switch-parsing routine, but the switch\n   * values read here are ignored; we will rescan the switches after opening\n   * the input file.\n   * (Exception: tracing level set here controls verbosity for COM markers\n   * found during jpeg_read_header...)\n   */\n\n  file_index = parse_switches(&cinfo, argc, argv, 0, FALSE);\n\n#ifdef TWO_FILE_COMMANDLINE\n  /* Must have either -outfile switch or explicit output file name */\n  if (outfilename == NULL) {\n    if (file_index != argc - 2) {\n      fprintf(stderr, \"%s: must name one input and one output file\\n\",\n              progname);\n      usage();\n    }\n    outfilename = argv[file_index + 1];\n  } else {\n    if (file_index != argc - 1) {\n      fprintf(stderr, \"%s: must name one input and one output file\\n\",\n              progname);\n      usage();\n    }\n  }\n#else\n  /* Unix style: expect zero or one file name */\n  if (file_index < argc - 1) {\n    fprintf(stderr, \"%s: only one input file\\n\", progname);\n    usage();\n  }\n#endif /* TWO_FILE_COMMANDLINE */","sourceCodeStart":546,"sourceCodeEnd":582,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/jni/mozjpeg/djpeg.c#L546-L582","documentation":"In djpeg's TWO_FILE_COMMANDLINE mode, when no -outfile switch was given, it expects exactly two positional file arguments (input and output). If file_index != argc-2 the count is wrong, this message prints, and usage() exits. This branch is the missing-output-file case (no -outfile).","triggerScenarios":"Running djpeg with no -outfile and a positional count other than exactly two (e.g. djpeg in.jpg with only the input, or three+ files).","commonSituations":"Assuming djpeg writes to stdout when TWO_FILE_COMMANDLINE is defined; forgetting the output argument; glob expansion to multiple inputs.","solutions":["Provide exactly one input and one output positionally: djpeg in.jpg out.ppm.","Or use -outfile <path> with a single input positional.","If stdout output is required, use a build without TWO_FILE_COMMANDLINE or redirect the single output to /dev/stdout."],"exampleFix":"# before: only input, no output (TWO_FILE_COMMANDLINE build)\ndjpeg in.jpg\n# after\ndjpeg in.jpg out.ppm\n# or\ndjpeg -outfile out.ppm in.jpg","handlingStrategy":"validation","validationCode":"#!/bin/sh\nhas_outfile=0; pos=()\nfor a in \"$@\"; do case \"$a\" in -outfile) has_outfile=1;; -*) ;; *) pos+=(\"$a\");; esac; done\n[ \"$has_outfile\" -eq 0 ] && [ \"${#pos[@]}\" -ne 2 ] && { echo 'djpeg needs exactly one input and one output file' >&2; exit 1; }\ndjpeg \"$@\"","typeGuard":"// n/a: argv-count validation in the caller.","tryCatchPattern":"if ! djpeg \"$@\" 2>/tmp/e; then\n  grep -q 'must name one input and one output file' /tmp/e && { echo 'supply input + output (or use -outfile)'; exit 1; }\nfi","preventionTips":["Separate options from positionals in wrapper scripts and assert counts.","Default to -outfile for explicit output.","Document the deployed djpeg commandline style."],"tags":["mozjpeg","djpeg","cli-argument","commandline","missing-output"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}