How to fix E: The list of sources could not be read in APT
This error occurs when one or more files in your apt sources directory contain syntax errors or malformed entries. Identifying and fixing the problematic source file restores apt functionality.
Quick fix
Fixes E: The list of sources could not be read
sudo apt-get check- Run apt-get check to identify the broken file
- Open the problematic source file
- Fix or remove the malformed line
- Save and verify the fix
sudo apt-get checkE: The list of sources could not be read
What this error means
The apt package manager reads repository source configuration from /etc/apt/sources.list and files in /etc/apt/sources.list.d/. When these files contain malformed entries—syntax errors, invalid URIs, or broken formatting—apt cannot parse them during update or install operations. This prevents apt from accessing any software repositories until the broken source file is corrected or removed.
Typical symptoms
- apt update or apt install fails immediately with "list of sources could not be read" error
- Error message includes file path like "/etc/apt/sources.list.d/thirdparty.list"
- apt-get check command displays "malformed entry" in specific file
- Software Update GUI tools fail to open or refresh
- All apt operations fail regardless of which package is being installed
Common causes
- Malformed entry in sources.list or sources.list.d file from manual editing
- Corrupted or incomplete source line after software installation/uninstallation
- Invalid URI format or missing required fields in a repository entry
- Stray characters, missing quotes, or indentation errors in source files
- PPA (Personal Package Archive) with incorrect syntax
How to fix "E: The list of sources could not be read"
Run the diagnostic command:
sudo apt-get checkThis will output which file contains the malformed entry, for example:
E: Malformed entry 1 in sources file /etc/apt/sources.list.d/rethinkdb.list (Component)
E: The list of sources could not be readNote the file path and line number mentioned in the error.
Use a text editor to open the file identified in the previous step:
sudo nano /etc/apt/sources.list.d/rethinkdb.listIf the error is in the main sources list, edit:
sudo nano /etc/apt/sources.listLook at the line number mentioned in the error. Check for:
- Missing or extra spaces
- Incomplete repository URL
- Invalid component name
- Missing distribution codename
A valid source line looks like:
deb https://archive.ubuntu.com/ubuntu/ bionic main universe multiverseEither fix the syntax or delete the entire line if you don't recognize the repository.
Save the file (in nano: Ctrl+O, then Ctrl+X).
Run apt-get check again:
sudo apt-get checkIf the error is gone, continue to the next step. If the same file is still reported, check for additional broken lines.
Now rebuild the package cache with:
sudo apt updateThis downloads fresh package lists from all configured sources. The error should not appear.
If the file contains only a third-party repository you no longer need, remove it entirely:
sudo rm /etc/apt/sources.list.d/rethinkdb.list
sudo apt updateDo NOT remove /etc/apt/sources.list itself, as it contains the main Ubuntu/Debian repositories. Only remove files in the .d/ directory if they are causing issues.
Advanced notes
You can view all currently configured sources with apt-cache policy or by listing the entire sources.list.d directory: ls /etc/apt/sources.list.d/. If multiple files are broken, use grep -r "^deb" /etc/apt/sources.list.d/ to inspect all of them. For PPA sources added via add-apt-repository, use sudo add-apt-repository --remove ppa:username/ppaname to cleanly remove them instead of manually editing. After fixing sources, if you see "Failed to fetch" errors, the repository URL may be down or your network connection may be unreachable—verify the URL is current and accessible before reporting it as broken.
Frequently asked questions
- What does "E: The list of sources could not be read" mean?
- d/. When these files contain malformed entries—syntax errors, invalid URIs, or broken formatting—apt cannot parse them during update or install operations. This prevents apt from accessing any software repositories until the broken source file is corrected or removed.
- How do I fix "E: The list of sources could not be read"?
- This error occurs when one or more files in your apt sources directory contain syntax errors or malformed entries. Identifying and fixing the problematic source file restores apt functionality.
- What causes "E: The list of sources could not be read"?
- Malformed entry in sources.list or sources.list.d file from manual editing Corrupted or incomplete source line after software installation/uninstallation Invalid URI format or missing required fields in a repository entry
- Is the "E: The list of sources could not be read" error serious?
- It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.