DrKLO/Telegram · error

Non-numeric data in file %s

Error message

Non-numeric data in file %s

What it means

After reading all quantization tables, read_quant_tables checks the terminating character. If termchar is not EOF, it means there is leftover non-numeric data in the file after the valid table content -- likely a formatting error. The function reports non-numeric data, closes the file, and returns FALSE. This catches trailing garbage that is not a valid integer.

Source

Thrown at TMessagesProj/jni/mozjpeg/rdswitch.c:129

      if (! read_text_integer(fp, &val, &termchar)) {
        fprintf(stderr, "Invalid table data in file %s\n", filename);
        fclose(fp);
        return FALSE;
      }
      table[i] = (unsigned int) val;
    }
#if JPEG_LIB_VERSION >= 70
    jpeg_add_quant_table(cinfo, tblno, table, cinfo->q_scale_factor[tblno],
                         force_baseline);
#else
    jpeg_add_quant_table(cinfo, tblno, table, q_scale_factor[tblno],
                         force_baseline);
#endif
    tblno++;
  }

  if (termchar != EOF) {
    fprintf(stderr, "Non-numeric data in file %s\n", filename);
    fclose(fp);
    return FALSE;
  }

  fclose(fp);
  return TRUE;
}


#ifdef C_MULTISCAN_FILES_SUPPORTED

LOCAL(boolean)
read_scan_integer (FILE *file, long *result, int *termchar)
/* Variant of read_text_integer that always looks for a non-space termchar;
 * this simplifies parsing of punctuation in scan scripts.
 */
{
  register int ch;

View on GitHub (pinned to 45ab8f4308)

Solutions

  1. Open the table file and remove any trailing non-numeric content after the last table's 64th value.
  2. Ensure comments only use the '#' prefix, which read_text_integer handles correctly.
  3. Re-save the file ensuring it contains only whitespace-separated integers and '#' comments.

Example fix

# before: table file ends with "64128 garbage_text"
# after: table file ends with "64 128" and nothing else
# Remove trailing non-numeric lines
sed -i '/[^0-9[:space:]-]/d' table.qtl
Defensive patterns

Strategy: validation

Validate before calling

// Pre-validate: ensure the file contains only numbers and # comments
#include <stdio.h>
static boolean check_trailing_garbage(const char *filename) {
  FILE *fp = fopen(filename, "r");
  if (!fp) return FALSE;
  long val; int termchar;
  read_text_integer(fp, &val, &termchar);
  boolean clean = (termchar == EOF);
  fclose(fp);
  return clean;
}

Prevention

When it happens

Trigger: A quantization table file with trailing non-numeric text after the last complete table; a stray character or comment that is not properly formatted; extra data after the final table's 64th value that read_text_integer cannot parse as an integer.

Common situations: Files with inline comments not prefixed with '#'; copy-paste artifacts at the end of the file; files saved with extra blank lines or special characters after the data; editing tools that append metadata.

Related errors


AI-assisted analysis of DrKLO/Telegram@45ab8f4308 (2026-08-14). Data as JSON: /api/errors/d0ddf9fda28cb0b7. Report an issue: GitHub.