DrKLO/Telegram · error
Invalid scan entry format in file %s
Error message
Invalid scan entry format in file %s
What it means
The scan definition parser expects each entry to follow the format: component indices (space-separated), optional ': Ss Se Ah Al' for progressive parameters, terminated by ';' or EOF. If the terminating character after parsing an entry is neither ';' nor EOF (or if read_scan_integer fails during progressive parameter parsing), execution jumps to the 'bogus' label and reports an invalid scan entry format.
Source
Thrown at TMessagesProj/jni/mozjpeg/rdswitch.c:245
if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ')
goto bogus;
scanptr->Se = (int) val;
if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ')
goto bogus;
scanptr->Ah = (int) val;
if (! read_scan_integer(fp, &val, &termchar))
goto bogus;
scanptr->Al = (int) val;
} else {
/* set non-progressive parameters */
scanptr->Ss = 0;
scanptr->Se = DCTSIZE2-1;
scanptr->Ah = 0;
scanptr->Al = 0;
}
if (termchar != ';' && termchar != EOF) {
bogus:
fprintf(stderr, "Invalid scan entry format in file %s\n", filename);
fclose(fp);
return FALSE;
}
scanptr++, scanno++;
}
if (termchar != EOF) {
fprintf(stderr, "Non-numeric data in file %s\n", filename);
fclose(fp);
return FALSE;
}
if (scanno > 0) {
/* Stash completed scan list in cinfo structure.
* NOTE: for cjpeg's use, JPOOL_IMAGE is the right lifetime for this data,
* but if you want to compress multiple images you'd want JPOOL_PERMANENT.
*/
scanptr = (jpeg_scan_info *)View on GitHub (pinned to 45ab8f4308)
Solutions
- Follow the exact format: component indices separated by spaces, then optional ': Ss Se Ah Al', terminated by ';'.
- Example valid entry: '0 1 2: 0 0 0 0;' (components 0,1,2, progressive params Ss=0 Se=0 Ah=0 Al=0).
- Use a known-good scan script template and modify values carefully.
- Validate the file for stray non-ASCII characters or incorrect separators.
Example fix
# before (invalid: missing semicolon, wrong separator) 0,1,2: 0 0 0 0 # after (valid) 0 1 2: 0 0 0 0;
Defensive patterns
Strategy: validation
Validate before calling
// Pre-validate scan entry syntax: components then optional ': Ss Se Ah Al' then ';'
static boolean validate_scan_syntax(const char *filename) {
FILE *fp = fopen(filename, "r");
if (!fp) return FALSE;
int c;
boolean ok = TRUE;
while ((c = fgetc(fp)) != EOF) {
if (c == ',') ok = FALSE; // commas are invalid separators
}
fclose(fp);
return ok;
} Prevention
- Use a known-good scan script template and only modify numeric values.
- Ensure component indices are space-separated, not comma-separated.
- Verify each scan entry ends with ';' except possibly the last (which can end with EOF).
- Test scan scripts on small images before using them in production pipelines.
When it happens
Trigger: A scan entry with incorrect syntax: wrong separator character (e.g., using ',' instead of ' '), missing semicolon between entries, or malformed progressive parameters after the colon. Also triggered when read_scan_integer fails during the Ss/Se/Ah/Al field parsing.
Common situations: Hand-written scan scripts with syntax errors; scan files copied from a different format; trailing characters after a valid scan entry; using a colon but not providing all four progressive parameters (Ss Se Ah Al); encoding issues introducing invisible characters.
Related errors
- Too many scans defined in file %s
- Too many components in one scan in file %s
- %s: skip region exceeds image height %d\n
- %s: crop dimensions exceed image dimensions %d x %d\n
- %s: can only do one image transformation at a time
AI-assisted analysis of DrKLO/Telegram@45ab8f4308 (2026-08-14).
Data as JSON: /api/errors/14e8406e710766f2.
Report an issue: GitHub.