How to fix E: The value 'priority' is invalid for APT::Preferences in APT

APTINTERMEDIATEHIGHUpdated Dec 29, 2025ยท 134 views

This error occurs when the Pin-Priority field in /etc/apt/preferences or /etc/apt/preferences.d/ contains an invalid value. Pin-Priority must be a positive or negative integer, and common causes include non-numeric values, missing the Pin-Priority keyword, or incorrect syntax formatting.

Quick fix

Fixes E: The value 'priority' is invalid for APT::Preferences

cat /etc/apt/preferences
ls -la /etc/apt/preferences.d/
  1. Check for syntax errors in your preferences files
  2. Verify the correct Pin-Priority syntax
  3. Correct invalid priority values
  4. Ensure proper file formatting
apt โ€” error
cat /etc/apt/preferences
ls -la /etc/apt/preferences.d/
E: The value 'priority' is invalid for APT::Preferences

What this error means

APT (Advanced Package Tool) validates the syntax of your preferences configuration files when parsing them. The error "The value 'priority' is invalid for APT::Preferences" indicates that APT encountered a malformed or invalid value in the Pin-Priority field. This field controls package installation priorities and must be an integer between -1 and an upper limit (typically 1000+). When APT reads your preferences files, it strictly validates this field and will reject any non-numeric values, malformed syntax, or invalid configurations.

Typical symptoms

  • apt update, apt install, or apt-get commands fail with the error message
  • Package manager becomes unusable until the preferences file is fixed
  • APT operations that read preferences files consistently fail
  • Error appears when running any apt-related command that needs to evaluate package priorities

Common causes

  1. Using 'Priority' instead of the correct 'Pin-Priority' keyword
  2. Non-numeric values in the Pin-Priority field (e.g., 'high', 'low', 'medium' instead of numbers)
  3. Special characters or invalid syntax in the priority value
  4. Missing blank lines between preference blocks causing parsing errors
  5. Extra whitespace or tabs in the preferences file
  6. Invalid Pin syntax or malformed Pin field definition

How to fix "E: The value 'priority' is invalid for APT::Preferences"

1Check for syntax errors in your preferences files

List and examine all APT preferences files:

bash
cat /etc/apt/preferences
ls -la /etc/apt/preferences.d/

Look for recently modified or added files. The error message typically indicates which file has the problem.

2Verify the correct Pin-Priority syntax

Ensure each preference block follows the correct format:

bash
Package: package-name
Pin: release a=stable
Pin-Priority: 500

Package: another-package
Pin: origin example.com
Pin-Priority: 900

Note that the keyword is Pin-Priority (not Priority), and the value must be a positive or negative integer.

3Correct invalid priority values

Replace any non-numeric or text-based priority values with valid integers:

- Priority 0-99: Install only if no other version exists
- Priority 100-499: Install unless newer version from another source
- Priority 500-989: Install unless target release version is available
- Priority 990+: Install even if it's a downgrade
- Negative values: Prevent the version from being installed

Do NOT use text values like 'high', 'low', 'medium', or 'priority'.

4Ensure proper file formatting

Verify each preferences block is properly separated:

- Each block must end with a blank line (except the last block)
- No trailing whitespace after values
- File must end with a newline character
- Files in /etc/apt/preferences.d/ must have valid names (alphanumeric, hyphen, underscore, period only)

You can use a text editor to check:

bash
nano /etc/apt/preferences
# or
vim /etc/apt/preferences
5Validate the configuration

After making corrections, test the configuration:

bash
apt-cache policy

If no errors appear, the syntax is valid. Then try a normal APT operation:

bash
sudo apt update
6Remove problematic preferences files (if needed)

If you cannot identify the error, temporarily rename the preferences file:

bash
sudo mv /etc/apt/preferences /etc/apt/preferences.bak
sudo apt update

If this works, the issue was in the main preferences file. You can then examine the backup and fix it, or remove the file entirely if it's not needed.

Advanced notes

The Pin-Priority field accepts any integer value, but APT interprets them in specific ranges. Values equal to 0 have undefined behavior and should never be used. If you're using preferences for multiple distribution pinning, remember that the first matching specific-form record wins, so place wildcard pins first. The files in /etc/apt/preferences.d/ are parsed in alphanumeric order, which can affect which rule takes precedence if multiple files define preferences for the same package. For debugging, you can run apt-cache policy <package> to see how APT is interpreting your preferences for a specific package.

Frequently asked questions

What does "E: The value 'priority' is invalid for APT::Preferences" mean?
APT (Advanced Package Tool) validates the syntax of your preferences configuration files when parsing them. The error "The value 'priority' is invalid for APT::Preferences" indicates that APT encountered a malformed or invalid value in the Pin-Priority field. This field controls package installation priorities and must be an integer between -1 and an upper limit (typically 1000+).
How do I fix "E: The value 'priority' is invalid for APT::Preferences"?
This error occurs when the Pin-Priority field in /etc/apt/preferences or /etc/apt/preferences.d/ contains an invalid value. Pin-Priority must be a positive or negative integer, and common causes include non-numeric values, missing the Pin-Priority keyword, or incorrect syntax formatting.
What causes "E: The value 'priority' is invalid for APT::Preferences"?
Using 'Priority' instead of the correct 'Pin-Priority' keyword Non-numeric values in the Pin-Priority field (e.g., 'high', 'low', 'medium' instead of numbers) Special characters or invalid syntax in the priority value
Is the "E: The value 'priority' is invalid for APT::Preferences" error serious?
Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.

Official resources & further reading