# Redis: Bad file format reading the append only file: make a backup of your AOF file, then use ./redis-check-aof --fix <filename>

**Code:** `Bad file format reading the append only file / AOF corrupted` · **Category:** Redis · **Seen on:** Redis, Linux

Redis can't load the AOF on startup because it's truncated or corrupted, so the server refuses to start.

## Meaning

Back up the file, then repair with `redis-check-aof --fix appendonly.aof` (for Redis 7 multi-part AOF use the manifest dir files). Truncation from a crash/disk-full is the usual cause; with `aof-load-truncated yes` Redis can start loading a truncated tail automatically. Verify disk space and hardware afterwards.

## Common causes

- Crash or power loss during write
- Disk full while appending
- File truncated by copying/restoring
- Manual edit/corruption
- Different Redis version format

## Quick fix

1. `cp appendonly.aof appendonly.aof.bak && redis-check-aof --fix appendonly.aof`
2. Enable `aof-load-truncated yes`
3. Restore from RDB or replica if repair loses too much

## Detailed fix by platform

### Linux

1. `redis-check-aof --fix /var/lib/redis/appendonlydir/appendonly.aof.1.incr.aof`

## How to diagnose

1. **File** — Truncated?
2. **Disk** — Was full?
3. **Backup** — Taken?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/redis/redis-aof-corrupted-unexpected-end)
