Updated: 28 September 2026 · Applies to: dnf 4.14 to 4.20 on AlmaLinux and Rocky Linux 9 and 10 and RHEL 9 and 10 (yum is an alias of dnf)

The error

Bad id for repo: My Repo, byte =   2

appears when a repository file in /etc/yum.repos.d/ has an ID with characters dnf does not accept. We reproduced it on AlmaLinux 9 with a section called [My Repo]. The ID is the text in square brackets at the top of each section. After "byte =" dnf prints the first invalid character and its position, counting from 0: here a space (which looks empty) at position 2. With [my+repo] the message reads "byte = + 2".

Fix

  1. Find the file:
    grep -rn '^\[' /etc/yum.repos.d/
    Look for an ID with spaces or other special characters.
  2. Change the ID to letters, digits and -, _, . or : only, for example:
    [my-repo]
    name=My Repo
    baseurl=https://repo.example.com/el9/
    enabled=1
    gpgcheck=1
    The name= line may contain spaces; only the ID in brackets may not.
  3. Test:
    dnf clean metadata
    dnf repolist

If you do not recognise the repository, it was probably added by a third-party installer. Remove its file or set enabled=0 instead of fixing it.

For more on managing repositories, see how to create and host your own DNF repository.

Official documentation: DNF configuration reference (repository options).

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket