Skip to main content
whitep4nth3r logo

18 Dec 2023

1 min read

How to fix error: invalid character in entity name in RSS feeds

My RSS feed was broken for OVER A WEEK because I used an invalid character in the XML.

I use a GitHub action to update my GitHub profile README with my latest blog posts. For over a week the job had been failing, and I ignored it (rookie mistake). It turns out I had broken my RSS feed when I edited some blog post descriptions and used a character that wasn't valid in XML (referred to as an invalid token).

The error in the GitHub action workflow run wasn't very helpful, though: "Error: Invalid character in entity name". 🫠

Error feed.xml runner failed, please verify the configuration. Error: invalid character in entity name. Line 1579. Column 152. Char not specified. 0 blog posts fetched.

Luckily, the RSS Feed Validation Service provided by W3C gave a better error report.

Sorry. This feed does not validate. Line 1597, column 151: XML parsing error, not well-formed (invalid token). The line that broke it was: information to screen-readers & (ampersand) assistive tech in the description tag.

This helped me track down the invalid character to an ampersand (&), which I added to a blog post description a week ago to reduce the character count. The resulting invalid description tag in the XML document looked like this:

<title>When to use aria-labels in your HTML</title>
<description>This is one of the most important ways to use aria-labels so your code provides contextual information to screen-readers & assistive tech.

I did some further reading on XML and learned that ampersands, and left and right angled brackets (< and >) must be escaped in XML in order for the document to be valid, unless wrapped in a CDATA section. Read more about XML character data and markup on the official W3C docs.

Like weird newsletters?

Join undefined subscribers in the Weird Wide Web Hole to find no answers to questions you didn't know you had.


Salma sitting cross legged on a sofa, holding a microphone, looking up into the right of the space.

Salma Alam-Naylor

I'm a live streamer, software engineer, and developer educator. I help developers build cool stuff with blog posts, videos, live coding and open source projects.

Related posts

21 Mar 2022

How to format dates for RSS feeds (RFC-822)

Here's a selection of links, guidance and code snippets to help you format dates for RSS feeds (RFC-822).

Tutorials 2 min read →

27 May 2021

How to use GitHub actions and Contentful webhooks to show your latest blog posts on your GitHub README

Want to show your latest blog posts on your GitHub README? Here's how I do it using the power of GitHub actions and webhooks in Contentful.

Tutorials 4 min read →