SAXParseException — XML Parsing Error in Solr Configuration Files

Errors

The Error

You reload your Opensolr Index (or upload new config files) and it fails with one of these errors:

org.apache.solr.common.SolrException: Unable to reload core [your_core]
Caused by: Error loading solr config from .../solrconfig.xml
Caused by: org.xml.sax.SAXParseException; lineNumber: 18; columnNumber: 13;
Open quote is expected for attribute "name" associated with an element type "array".

Or:

ERROR XmlConfigFile:168 - Exception during parsing file: solrconfig.xml
org.xml.sax.SAXParseException: Open quote is expected for attribute "name"

Or similar errors mentioning:

  • SAXParseException
  • Open quote is expected
  • element type is not closed
  • The element type must be terminated
  • Content is not allowed in prolog
  • Unexpected end of file
  • Exception during parsing file

All of these mean the same thing: your XML configuration file has a syntax error, and Solr cannot parse it.


What Is Actually Happening

Solr's configuration files (solrconfig.xml, schema.xml, search.xml, and all extras) are XML files. XML has very strict syntax rules — much stricter than HTML. A single missing quote, an unclosed tag, or a stray character will cause the entire file to be rejected.

When Solr tries to reload your index, it reads these XML files through a parser called SAX (Simple API for XML). If the parser hits invalid syntax, it throws a SAXParseException and the reload fails. Your index stays on the old configuration — nothing is broken, but the new config is not applied.

COMMON XML SYNTAX ERRORS IN SOLR CONFIG FILESMissing Quotes<str name=value> should be name="value"Unclosed Tags<str name="x">value missing </str>Mismatched Tags<str>value</int> opening != closingInvalid Characters& instead of &amp; < inside valuesCopy-Paste ArtifactsSmart quotes, invisible Unicode, BOM charactersWrong EncodingFile not saved as UTF-8, special chars breakThe error message tells you the file name, line number, and what went wrong.Use those to find and fix the exact problem.


How to Read the Error Message

The SAXParseException error gives you everything you need to find the problem:

org.xml.sax.SAXParseException;
  systemId: solrres:/search.xml;    ← THE FILE with the error
  lineNumber: 18;                   ← THE LINE number
  columnNumber: 13;                 ← THE COLUMN on that line
  Open quote is expected for        ← WHAT is wrong
  attribute "name" associated
  with an element type "array".

In this example:

  • The error is in search.xml (not solrconfig.xml — but referenced by it)
  • On line 18, column 13
  • The attribute name is missing its opening quote

Common Errors and Fixes

Missing or Wrong Quotes

The most common error. XML requires double quotes around attribute values.

<!-- WRONG — missing quotes -->
<str name=myfield>value</str>
<arr name=components>

<!-- CORRECT — double quotes required -->
<str name="myfield">value</str>
<arr name="components">

Also watch for smart quotes (curly quotes) pasted from word processors or web pages:

<!-- WRONG — smart/curly quotes (look similar but are different characters!) -->
<str name=\xe2\x80\x9cmyfield\xe2\x80\x9d>value</str>

<!-- CORRECT — straight double quotes -->
<str name="myfield">value</str>

Unclosed or Mismatched Tags

Every opening tag must have a matching closing tag with the exact same name.

<!-- WRONG — unclosed tag -->
<str name="dir">${solr.ulog.dir:}

<!-- WRONG — mismatched tags -->
<str name="dir">${solr.ulog.dir:}</int>

<!-- CORRECT -->
<str name="dir">${solr.ulog.dir:}</str>

Unescaped Special Characters

XML has five characters that must be escaped when used inside values:

Character Escaped Form Example
& &amp; rock &amp; roll
< &lt; value &lt; 100
> &gt; value &gt; 50
" &quot; inside attributes
' &apos; inside attributes
<!-- WRONG — unescaped ampersand -->
<str name="q">rock & roll</str>

<!-- CORRECT — escaped ampersand -->
<str name="q">rock &amp; roll</str>

Files Referenced by solrconfig.xml

The error might point to a file like search.xml, elevate.xml, or solrconfig_extra.xml. These are included by solrconfig.xml via <xi:include> directives. The syntax error is in that referenced file, not in solrconfig.xml itself.

Check the systemId in the error message to find the right file:

  • solrres:/search.xml → edit search.xml
  • solrres:/schema.xml → edit schema.xml
  • solrres:/solrconfig_extra.xml → edit solrconfig_extra.xml

How to Fix It

Step 1: Identify the File and Line

Read the error message. It tells you the file name, line number, and column number.

Step 2: Open the File in the Config Editor

Go to your Opensolr Index Control PanelConfig Files Editor → select the file mentioned in the error.

Step 3: Go to the Exact Line

Navigate to the line number mentioned in the error. Look for:

  • Missing or extra quotes
  • Unclosed tags
  • Unescaped &, <, or > characters
  • Tags that open as one name and close as another

Step 4: Fix and Save

Correct the XML syntax error. Save the file.

Step 5: Reload

Click Reload in your Opensolr control panel. If the reload succeeds, the fix worked. If it fails again, read the new error message — there may be another syntax error on a different line.


How to Validate XML Before Uploading

Before uploading config files to Opensolr, validate them locally:

Using xmllint (Linux/Mac):

xmllint --noout solrconfig.xml
# No output = valid XML
# Error output = shows line and column of the problem

Online validators: Search for "XML validator online" — paste your XML and it will highlight syntax errors instantly.


Quick Checklist

  • Read the error message — it tells you the file, line, and problem
  • Check for missing quotes around attribute values (most common cause)
  • Check for unclosed tags — every <tag> needs a </tag>
  • Check for unescaped characters& must be &amp;, < must be &lt;
  • Watch for smart quotes from copy-paste — replace with straight " quotes
  • If the error points to search.xml or *_extra.xml, edit that file, not solrconfig.xml
  • Use xmllint to validate XML locally before uploading
  • Reload after fixing — if it succeeds, you are good

Having trouble finding the XML error? Reach out to us at support@opensolr.com with the error message — we will pinpoint and fix it for you.