EDF file won’t open: causes and fixes
Most files that fail are cut short, mislabelled or written with a faulty header.
What the message means
The Online EEG Reviewer checks the header before it reads any samples and says why a file fails. The app checks the header the same way and gives the same reasons for the first four messages below.
| The message starts | Usual cause | What to try |
|---|---|---|
| This file could not be opened as EDF / EDF+ or BDF / BDF+ | The file is not EDF or BDF inside: a ZIP download, a vendor’s own format or a text export renamed .edf. | Unzip it, or export the recording as EDF+ from the software that made it. |
| The EDF / BDF header appears incomplete or corrupted | The file is shorter than its header says, usually a copy or download that stopped early. | Copy or download it again, and compare its size with the original. |
| The EDF / BDF header could not be parsed | A header field that must hold a number does not, or a channel has no samples per data record. A file that holds only annotations, such as a sleep scoring file, gets this message too: its data records last 0 s. | Save the file again as EDF+ in the software that wrote it. For a scoring file, open the recording it belongs to. |
| The EDF+ / BDF+ timekeeping is missing or inconsistent | An EDF+D file without its annotation signal, or an EDF+C file whose data records do not follow one another. | Save it again as EDF+. See [What is EDF+D](/tutorials/what-is-edf-plus-d). |
| This recording has no signal channel with a valid calibration | The physical or digital range of every channel is zero, so no value can be turned into µV. | Export the recording again with its calibration. |
| This recording contains no data records | The header counts no data records: the recording stopped before any data were written. | Look for a longer copy of the recording. |
A recording that was not closed
While a recording is running, its header may say −1 data records, because the number is not known yet. If the software stops before it writes the real number, the file keeps −1. The Online EEG Reviewer then counts the records from the file size, and the file opens as long as it ends on a whole record. When the last record is cut off, the file is declined.
Check the header yourself
The header is text at the start of the file: 256 bytes for the recording, then 256 for each signal. These lines of Python read it and compare the size it implies with the real size of the file. They need nothing outside Python.
import os
path = "recording.edf" # or a .bdf file
with open(path, "rb") as f:
head = f.read(256)
ns = int(head[252:256]) # number of signals
signals = f.read(ns * 256)
start = ns * 216 # the samples-per-record fields
samples = [int(signals[start + 8 * i:start + 8 * i + 8]) for i in range(ns)]
width = 3 if head[0] == 255 else 2 # bytes per sample: BDF 3, EDF 2
header_bytes = int(head[184:192])
records = int(head[236:244])
print("format:", head[0:8].decode("latin-1").strip(), head[192:236].decode("latin-1").strip())
print("signals:", ns, "records:", records, "seconds per record:", float(head[244:252]))
print("bytes expected:", header_bytes + records * sum(samples) * width, "file:", os.path.getsize(path))- format shows 0 for EDF and ÿBIOSEMI for BDF, then EDF+C, EDF+D, BDF+C or BDF+D, 24BIT for a BioSemi BDF, or nothing for plain EDF.
- If a line fails with ValueError, that header field does not hold a number: the header itself is faulty.
Try a file that opens
To tell a problem with the file from a problem with your computer, open a file that is known to work.
Common problems
The file ends in .rec
Some systems name EDF files .rec. The Online EEG Reviewer and the app open them as EDF.
Another program opens it
Some readers trust the file size when the header disagrees with it, and show what they can. The Reviewer declines a file that is shorter than its header says, rather than guess which is right. Saving it again as EDF+ in the software that wrote it usually gives a file that opens everywhere.
It opens, but some channels are missing
Channels whose physical or digital range is zero have nothing to convert to µV, so they are not drawn. See How to open an EDF file.