DrKLO/Telegram · error

%s: FAILED. Checksum is %s

Error message

%s: FAILED.  Checksum is %s

What it means

The computed MD5 hash of the file does not match the reference hash provided as an argument. After computing the MD5 via MD5File and comparing it case-insensitively with strcasecmp, if the two strings differ the program reports failure and prints the actual computed checksum so the user can inspect the discrepancy. The program exits with return code -1.

Source

Thrown at TMessagesProj/jni/mozjpeg/md5/md5cmp.c:56

  if (argc < 3) {
    fprintf(stderr, "USAGE: %s <correct MD5 sum> <file>\n", argv[0]);
    return -1;
  }

  if (strlen(argv[1]) != 32)
    fprintf(stderr, "WARNING: MD5 hash size is wrong.\n");

  md5sum = MD5File(argv[2], buf);
  if (!md5sum) {
    perror("Could not obtain MD5 sum");
    return -1;
  }

  if (!strcasecmp(md5sum, argv[1])) {
    fprintf(stderr, "%s: OK\n", argv[2]);
    return 0;
  } else {
    fprintf(stderr, "%s: FAILED.  Checksum is %s\n", argv[2], md5sum);
    return -1;
  }
}

View on GitHub (pinned to 45ab8f4308)

Solutions

  1. Compare the printed actual checksum to the expected one to determine if the file or the hash is wrong.
  2. Recompute and update the reference hash if the file is known to be correct and current: md5sum <file>.
  3. Redownload or rebuild the file if the actual checksum is unexpected (file corruption).
  4. Verify file integrity at the transfer/download layer if the hash mismatch is intermittent.

Example fix

# Recompute the correct hash and update the reference
md5sum input.jpg > expected.md5
md5cmp "$(cut -d' ' -f1 expected.md5)" input.jpg
Defensive patterns

Strategy: validation

Validate before calling

# Pre-verify checksum before relying on md5cmp
expected="d41d8cd98f00b204e9800998ecf8427e"
actual=$(md5sum "$file" | cut -d' ' -f1)
if [ "$expected" != "$actual" ]; then
  echo "Integrity check failed: expected $expected, got $actual" >&2
fi

Prevention

When it happens

Trigger: File contents changed since the reference hash was generated; truncated or partially downloaded file; wrong file path pointing to a different file; reference hash from a different version of the file; binary corruption during transfer.

Common situations: CI/CD pipelines verifying build artifact integrity where the artifact was rebuilt or updated without updating the stored hash; network transfers that truncate or alter bytes; decompression tools that produce slightly different output; stale cached hash values in version control.

Related errors


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