Google search console flagged a couple of my AMP pages with the error: Error in required structured data element

When I use the URL inspection tool, it says:

Linked AMP version is valid with warnings
Error in required structured data element

But in the HTML section of the crawled page, it says Sorry--no code highlighting available for this issue. I made sure to do a Live Test and not use code from Google's index.

However, when I run the same URL thrugh Google's Structured Data Testing Tool, it says there are 0 errors and 0 warnings. Additionally, when I add #development=1 to the end of the URL and use the Chrome DevTools console, it says AMP validation successful.

How can I find what the error is?

I want to add that all of the URLs with this issue are using the same template, and no valid URLs are using this template, so it's obvious this is not random.

Dani AI

Generated

Short, practical follow-up tied to 's thread: the intermittent "Error in required structured data element" on AMP pages is often caused by how the markup is delivered or parsed by Google (not just by missing properties). The fastest way to isolate the problem is a small, repeatable debug loop: (1) test the live AMP URL with Google's AMP and Rich Results testers, (2) fetch the exact HTML Googlebot sees, (3) swap in a minimal, well-formed JSON-LD snippet and re-run the tests. The official Rich Results and AMP test pages are useful starting points. (search.google.com)

Quick, practical checks to run locally or on a staging server:

  • Fetch what Googlebot gets and inspect for inline JSON-LD, unexpected HTML-escaping, or minifier corruption:

    curl -s -L -A "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" "https://example.com/your-amp-url/amp" -o amp.html
    grep -n 'type="application/ld+json"' amp.html || echo "no JSON-LD found"
  • Check image and logo URLs with curl -I to ensure 200 OK and correct content-type; blocked or unreachable images often break validation.

A safe isolation technique: comment out half of the structured data (or temporarily replace it with a tiny, valid JSON-LD block) and re-test; repeat until the offending fragment is found. Example minimal JSON-LD to try (replace values with real URLs/dates):

<script type="application/ld+json">
{"@context":"https://schema.org","@type":"Article","headline":"Test","datePublished":"2020-01-01T00:00:00Z","author":{"@type":"Person","name":"Test"},"publisher":{"@type":"Organization","name":"Org","logo":{"@type":"ImageObject","url":"https://example.com/logo.png"}},"image":"https://example.com/image.jpg"}
</script>

Common causes uncovered by this method: malformed JSON (trailing commas, HTML-escaped quotes), JSON injected only after client-side JS runs, different markup on canonical vs AMP, or caching/CDN serving an old template. After fixing, re-run the Live URL inspection and request validation in Search Console so Google rechecks the page. For general structured-data guidance and Search Console monitoring advice, see Google's docs. (developers.google.com)

I figured it out.

It's not a requirement of NewsArticle structured data, but AMP NewsArticles are required to include a big header image.

For anone curious, you can find all of the requirements here:

https://developers.google.com/search/docs/data-types/article

  • author
  • author.name
  • datePublished
  • headline
  • image
  • publisher
  • publisher.logo that follows very specific AMP logo guidelines
  • publisher.logo.url
  • publisher.name

Never mind, that ended up not being the problem :(

I have all the required components, all the required dimensions.

Can someone please help me figure out why pages such as this one are failing AMP verification:

https://www.daniweb.com/digital-media/ui-ux-design/op-ed/520339/which-one-to-opt-for-ui-or-ux-you-re-asking-the-wrong-question/amp

Google Search Console URL Inspection gives the error:

URL is available to Google, but has issues
If it gets indexed and selected as canonical, it could appear in Google Search results. However, some issues prevent it from being eligible for all enhancements. Learn more

Linked AMP version is valid with warnings
It is eligible for some AMP-specific features in Google Search results, but is not fully compliant with AMP best practices. Learn more

Error in required structured data element

All the other public AMP validators show no issues.

I figured out the reason for this but I never updated this thread.

It turns out that AMP news stories, tutorials, etc. require JSON-formatted structured data. Structured data embedded within the HTML tags doesn't count.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.