Text and data

How to Fix Power BI Theme JSON Import Errors

Fix invalid JSON first, then use the full property path to review schema errors in a Power BI theme. Open PageUtil Power BI Theme JSON Validator with the original file and work through the sample below. Finally import the candidate into your actual Power BI Desktop version and inspect the report visuals.

Power BI theme review: inspect the source, validate the result, then check the report
Find the problem, check the repair, then try the theme in your report.

Get the validator open and pick a broken theme

Keep this page in one tab and the validator in another. If you’re using your own theme, save a copy first. I’ve supplied a broken and corrected file for each example, so you can compare them if you get stuck. No prizes for making life harder than it needs to be.

Download the trailing-comma file from the first row. Drop it into Upload Theme JSON, choose your target Power BI Desktop version, and hit Validate Theme. We’ll start with that one, then work through the more interesting failures.

These are deliberately broken practice files. The pairs are covered by our automated validator tests; they haven’t been imported into Desktop for this walkthrough. We’ll get to that final check once the JSON is behaving.

ProblemTry itCompareRepair
Trailing commaInvalid JSON fileCorrected fileManual edit
Smart quotesInvalid JSON fileCorrected fileManual edit
Missing nameInvalid JSON fileCorrected fileAuto-fix, then revalidate
Non-hexadecimal colorInvalid JSON fileCorrected fileManual edit
Misspelled root keyInvalid JSON fileCorrected fileManual edit
Font size stored as textInvalid JSON fileCorrected fileManual edit
Formatting card must be an arrayInvalid JSON fileCorrected fileManual edit
Malformed solid fillInvalid JSON fileCorrected fileAuto-fix, then revalidate
Missing nested colorInvalid JSON fileCorrected fileManual edit
Direct visual fill stringInvalid JSON fileCorrected fileManual edit

That extra comma is enough to stop the whole thing

You should now have a JSON Syntax Error. Look at the comma just after "Walkthrough" in the example below. There’s no next property, so that comma has to go. Delete it in Theme JSON Content and press Validate Theme again. That’s our first fix: one character. A disproportionate amount of fuss, but there we are.

Try smart-quotes-invalid.json next. See those curly quotation marks? They look quite nice in a document. JSON is less impressed. Replace them with ordinary double quotes and validate again. Safe Auto-Fix won’t do this for you: when the file can’t be parsed, it leaves the text alone rather than guessing what you meant.

For your own file, use the error’s line number as a starting point. Once we reach schema errors, pay more attention to the full property path: line numbers are approximate when the same key appears in several places. A theme also needs an object at the top level—those outer curly braces—not an array or a quoted string.

Remove the final comma:
{"name":"Walkthrough",}

Then validate this:
{"name":"Walkthrough"}

Now let’s break the name and colours

Load missing-name-invalid.json and validate it. This time the JSON itself is readable, but the theme has no name. Click Safe Auto-Fix. You’ll see Repaired Custom Theme appear, followed by a fresh validation result. Give it a useful name before keeping it; “Repaired Custom Theme” is hardly going to win the branding meeting.

Next, try unknown-property-invalid.json. The offending key is dataColours. As a Londoner, I’m sympathetic, but the property is called dataColors. Change that key, keep the colour values, and validate again. We’re correcting the spelling the schema expects, not throwing away the palette.

Now load invalid-hex-invalid.json. Find dataColors[0] in the findings—that’s the first colour in the list. Its value is #12345G, and G isn’t a hexadecimal digit. For this demo, change it to #123456 and press Validate Theme. With your own branding, use the colour you actually intended. The tool can spot a bad value; it can’t read the designer’s mind.

One thing worth clearing up while we’re here: #abc is valid shorthand in the bundled schemas. Expanding it to #aabbcc is fine, but it wasn’t broken. Three-, six-, and eight-digit hex colours are accepted by those schema checks.

The first palette colour is invalid:
{"name":"Walkthrough","dataColors":["#12345G"]}

For this example, change it to:
{"name":"Walkthrough","dataColors":["#123456"]}

“fontSize must be a number”—but it is a number, isn’t it?

Open font-size-string-invalid.json and click Validate Theme. Follow the finding to visualStyles.barChart["*"].legend[0].fontSize. There’s our 12, sitting inside quotation marks. To us it looks like a number. To JSON, "12" is text. Remove the quotes, leave 12 in place, and validate again.

This is the same type of legend error reported in the Fabric Community thread linked below: someone saved a theme and then couldn’t import it back. Our small sample lets you practise that particular fix without picking through their whole report. It doesn’t mean every exported theme has the same problem.

Keep the edit local to fontSize. Don’t go removing quotes from everything that happens to look numeric. If you fancy another quick one, load card-not-array-invalid.json. Its background setting needs square brackets around the formatting object, even though there’s only one entry. Compare the corrected download and you’ll see exactly where they go.

The reported exported-theme import problem and fontSize error

This is text:
"legend": [{"fontSize": "12"}]

This is a number:
"legend": [{"fontSize": 12}]

Let’s fix the colour inside visualStyles

Load solid-string-invalid.json. Hit Validate Theme and look at the background colour finding. Here, solid contains "#123456" directly. The fill needs another object inside solid, with a property called color. Yes, it’s a colour inside a solid inside a colour. Stay with me.

Click Safe Auto-Fix and look back at the JSON. You should now see the nesting shown below, with transparency still set to 0. The tool has changed the malformed fill, kept the surrounding properties, and run validation again. That’s the bit to check before you download: did it fix the reported problem, and is the rest of your setting still there?

Try missing-solid-color-invalid.json and you’ll see where that automatic help stops. The colour is missing altogether, so you need to supply one. The direct-color sample also needs a manual edit; use its corrected download to compare the structure. Auto-fix handles the string inside solid, not every possible colour mistake.

You may get several findings for one fill because the schema checks different allowed shapes. Follow the property path and compare the example before changing everything in sight. A possible export-bug finding describes the broken structure; it doesn’t prove Power BI created the file. Some other fills, including valid pattern fills, allow direct colour strings.

Before Safe Auto-Fix:
{"color":{"solid":"#123456"},"transparency":0}

After:
{"color":{"solid":{"color":"#123456"}},"transparency":0}

If you want to look up the alternatives, here are Microsoft’s schema troubleshooting notes.

Check the version before calling it fixed

Before we download anything, look at Target Power BI Desktop Version. Choose the matching version if it’s available. Then click Cross-Version Audit to see how the theme fares against the other bundled schemas. This checks their rules; it isn’t running eight copies of Desktop behind the scenes. My electricity bill is quite enough, thanks.

If a schema hasn’t loaded, that version hasn’t been checked. Retry rather than counting it as a pass. If your exact version isn’t listed, a nearby version can help you investigate, but check the matching Microsoft schema separately before treating it as evidence for your release.

Now compare your original with the repaired JSON. Auto-fix can supply a name, add a $schema reference, tidy certain colour values, and repair the solid nesting we just tried. Unknown settings are kept for you to review. “Applied fixes” means those edits happened; look at the new validation result to find out whether anything still needs attention.

And that $schema link you may see at the top? It helps an editor locate the rules. It doesn’t override the version selected here or persuade an invalid theme to behave.

Microsoft’s custom theme documentation explains the file structure and links to the schemas.

It passes. Can anyone actually read it?

One last sample: download low-contrast-valid.json below and load it into the validator. The schema passes, but look at the contrast results. Pale text on a white background. Very subtle. Especially if you were hoping to read it.

Change foreground from #EEEEEE to #252423, then click Validate Theme again. Compare the foreground/background result. That gives us a much darker text colour against the same white background. The original was valid theme JSON all along; contrast is a separate check.

This audit compares opaque six-digit colours. Transparent colours need their actual background taken into account, so they’re excluded from those comparisons. An unsupported foreground or canvas colour makes the audit unavailable; omitted colours use tool defaults. Once you’re back in the report, check the real labels, backgrounds, text sizes, and whether colour is the only way to tell things apart.

Download the valid but low-contrast theme

Right, take the repaired theme back to Power BI

Happy with the findings and the changes? Download the reviewed theme, open a copy of your report in the target Desktop version, and import it there. Have a look at a chart, a table, the legend, the page background, and any custom visuals. This is where you check what the report actually does with the file.

If an existing visual seems to ignore your colours, compare it with a fresh visual. Manual formatting can override theme defaults. Don’t immediately undo the JSON fix because one chart has decided to keep its old outfit.

That’s the route I want you to take with your own theme: load it, follow the finding to the setting, make one understood change, and validate again. Keep the original until you’ve checked the report. If an error is still there after auto-fix, use its path to tackle the next setting rather than repeatedly pressing the button and hoping for a different answer.

For anyone checking the testing behind this guide, npm run test:power-bi runs the sample pairs and regressions for schema checks, repairs, version loading, contrast, and CSV output. A couple of limits to keep in mind: duplicate JSON keys currently keep their last value, and those automated checks don’t run Power BI Desktop or the Service. The report check is still yours to do.

Microsoft’s guidance on applying themes and formatting overrides

Continue troubleshooting

Related tools

Frequently asked questions

Why does valid JSON still fail theme validation?

The brackets and commas can be fine while the theme settings are wrong. The schema checks property names, nesting, types, and allowed values. Follow the reported path to find the setting that needs attention.

Does Safe Auto-Fix repair every theme error?

No. It handles a few predictable edits, such as adding a missing name or repairing a string inside solid. It can’t choose a missing brand colour for you. Check the fresh validation result after each repair.

Does a schema pass guarantee a successful Power BI import?

No. Download the reviewed file and try it in a copy of your report in the target Desktop version. Then check the visuals—the validator doesn’t run Power BI for you.

Need help with a tool or found a bug?

Report an issue directly to engineering. No accounts required — all client data remains private on your device.

Report an Issue →