AMP audits documentation

“amp-analytics” not found

code: amp_analytics_missing

In order to have your AMP pages traffic correctly tracked, you need to add the amp-analytics script in their <head>.

Read more

Attribute value required by layout

code: ATTR_VALUE_REQUIRED_BY_LAYOUT

Read more

Disallowed text inside tag

code: CDATA_VIOLATES_DENYLIST

Specific CSS data has been denylisted to validate essential CSS AMP rules.

The following is the list of denylisted CSS data (see also disallowed_cdata_regex in the AMP validator spec):

"\.i?-amp-" ("CSS -amp- class name prefix")
"!important"
"charset"
"&#64;import"
"@namespace"
"@document"
"@page"
"@viewport"

Read more

CSS syntax error - bad url

code: CSS_SYNTAX_BAD_URL

Read more

Important CSS disallowed syntax

code: CSS_SYNTAX_DISALLOWED_IMPORTANT

Usage of the !important CSS qualifier is not allowed.

Read more

CSS syntax error - disallowed media feature

code: CSS_SYNTAX_DISALLOWED_MEDIA_FEATURE

Read more

CSS syntax error - EOF in prelude of qualified rule

code: CSS_SYNTAX_EOF_IN_PRELUDE_OF_QUALIFIED_RULE

End of stylesheet encountered in prelude of a qualified rule.

Read more

CSS syntax error - incomplete declaration

code: CSS_SYNTAX_INCOMPLETE_DECLARATION

Read more

CSS syntax error - invalid at rule

code: CSS_SYNTAX_INVALID_AT_RULE

Read more

CSS syntax error - invalid declaration

code: CSS_SYNTAX_INVALID_DECLARATION

Read more

Disallowed AMP domain

code: DISALLOWED_AMP_DOMAIN

The script tag includes an invalid AMP domain in the src attribute.

Read more

Disallowed attribute

code: DISALLOWED_ATTR

Attributes are allowlisted, so there is no definitive list of all disallowed attributes. To check the supported attributes for each specific tag, search for HTML tag, and then attrs in the AMP validator spec.

In addition to a allowlist of specific attributes for each tag, all AMP tags can use any of the attributes allow-listed under $GLOBAL_ATTRS; all attributes with a prefix of “data-” are also allowlisted.

Read more

Disallowed child tag name

code: DISALLOWED_CHILD_TAG_NAME

Read more

DIsallowed first child tag name

code: DISALLOWED_FIRST_CHILD_TAG_NAME

Read more

Disallowed manufactured body

code: DISALLOWED_MANUFACTURED_BODY

Tag or text which is only allowed inside the body section found outside of the body section.

Read more

Disallowed property in attribute value

code: DISALLOWED_PROPERTY_IN_ATTR_VALUE

This error occurs when the property name inside an attribute is not allowed. The term property in this context means the structured key/value data inside an attribute.

For example, the following would result in an error:

<meta http-equiv="X-UA-Compatible" content="invalidfoo=edge">

It should be: <meta http-equiv="X-UA-Compatible" content="ie=edge">. As another example, in

<meta name="viewport content="width=device-width;minimum-scale=1">, width and minimum-scale are property names.

The following results in a DISALLOWED_PROPERTY_IN_ATTR_VALUE error:

<meta name="viewport content="width=device-width;invalidfoo=1">

Read more

Disallowed relative url

code: DISALLOWED_RELATIVE_URL

Read more

Disallowed script tag

code: DISALLOWED_SCRIPT_TAG

The AMP format does not allow custom JavaScript to be added to pages via the <script> element. Many common uses of JavaScript have AMP HTML library equivalent implementations. See AMP components for the set of components that can be used to enhance AMP HTML pages.

If none of the available components cover your use case, amp-script can be used to run your custom JavaScript.

Read more

Disallowed tag

code: DISALLOWED_TAG

Tags are allowlisted, so there is no definitive list of all disallowed tags; however, the AMP specification broadly defines the set of disallowed tags.

Read more

Disallowed tag ancestor

code: DISALLOWED_TAG_ANCESTOR

This error occurs when a tag is a descendant of another tag which doesn’t validate. Currently, the only example is a template tag, which may not be nested under another template tag.

Read more

Document too complex

code: DOCUMENT_TOO_COMPLEX

The document is too complex.

Read more

Duplicate attribute

code: DUPLICATE_ATTRIBUTE

Read more

Image duplicate for same dimension

code: DUPLICATE_DIMENSION

Multiple image candidates with the same width or pixel density found.

Read more

Duplicate unique tag

code: DUPLICATE_UNIQUE_TAG

This error occurs when exactly one instance of the tag is allowed, and a duplicate is found.

The full list of unique tags is known:

<doctype html>

<html amp>

<head>

<link rel=canonical href=...>

<link rel=amphtml href=...>

<meta charset="utf-8">

<meta viewport>

<style amp-custom>

<style amp-boilerplate>

Read more

Duplicate unique tag

code: DUPLICATE_UNIQUE_TAG_WARNING

Found more than once a certain tag supposed to be unique.

Read more

Extension unused

code: EXTENSION_UNUSED

An extension was found on this page, but is unused. Please remove this extension.

Some extensions examples are ‘amp-script’, ‘amp-analytics’, ‘amp-consent’, ‘amp-geo’, ‘amp-image-lightbox’ or ‘amp-video-docking’.

Read more

Validation was not possible

code: FAILED_VALIDATION

The system has not been able to validate the information in these URLs.

Read more

General disallowed tag

code: GENERAL_DISALLOWED_TAG

Found a tag that’s disallowed except in specific forms.

Read more

Incorrect minimum number of child tags

code: INCORRECT_MIN_NUM_CHILD_TAGS

Read more

Incorrect number of children tags

code: INCORRECT_NUM_CHILD_TAGS

Read more

Inline style too long

code: INLINE_STYLE_TOO_LONG

Found a tag with inline style over size limit in bytes.

Read more

Invalid attribute value

code: INVALID_ATTR_VALUE

This error indicates that an HTML tag has an attribute with an allowed name, but not an allowed value. For example, one common trigger for this error is invalid values for URLs. All URLs values (in href and src attributes) must match one of these possible attribute values.

IMPORTANT: Many URL values in AMP require HTTPS. If you are getting this error, and aren’t sure why, check the relevant AMP tag’s specification to see if the attribute requires HTTPS.

Read more

Invalid doctype html

code: INVALID_DOCTYPE_HTML

Invalid or missing doctype declaration. Should be ‘!doctype html’.

Read more

Invalid json

code: INVALID_JSON_CDATA

The script tag contains invalid JSON that cannot be parsed.

Read more

Invalid URL

code: INVALID_URL

This error occurs when a attribute has a URL, but the URL is invalid.

Read more

Invalid url protocol

code: INVALID_URL_PROTOCOL

This error occurs for tags that have an href or src that must be set to certain protocols. For example, many tags require https.

Read more

Mandatory attribute missing

code: MANDATORY_ATTR_MISSING

Mandatory attributes for AMP tags are defined within AMP’s validator spec. Simply search for the tag, view the listed attributes, and check for mandatory: true. Mandatory attributes for each AMP tag are also listed within the tag’s specification.

Read more

Mandatory last child tag

code: MANDATORY_LAST_CHILD_TAG

Read more

Mandatory attribute missing

code: MANDATORY_ONEOF_ATTR_MISSING

A tag was found missing a mandatory attribute.

Read more

Mandatory reference point missing

code: MANDATORY_REFERENCE_POINT_MISSING

Read more

Mandatory tag ancestor

code: MANDATORY_TAG_ANCESTOR

Mandatory descendants are defined in the AMP validator specification as mandatory_ancestor.

The error occurs when the following tags are missing their mandatory_ancestor (tag, ancestor):

img must be a descendant of noscript.

video must be a descendant of noscript.

audio must be a descendant of noscript.

noscript must be a descendant of body.

Read more

Mandatory tag ancestor with hint

code: MANDATORY_TAG_ANCESTOR_WITH_HINT

The error occurs when one of the following tags is found in the AMP document, and isn’t properly nested in its mandatory parent:

img isn’t within noscript parent.

video isn’t within noscript parent.

audio isn’t within noscript parent.

noscript isn’t within body parent.

Read more

Mandatory tag missing

code: MANDATORY_TAG_MISSING

The following tags must be present in all AMP docs:

<!doctype html>

<html amp> or <html ⚡>

<head>

<link rel="canonical" href="$SOME_URL">

<meta charset="utf-8">

<meta name="viewport" content="...">

<style amp-boilerplate>

<body>

These mandatory tags include a mandatory: true field in the AMP validator spec; they are also referenced in the AMP specification.

Read more

Missing layout properties

code: MISSING_LAYOUT_ATTRIBUTES

Read more

Missing required extension

code: MISSING_REQUIRED_EXTENSION

Read more

Missing URL

code: MISSING_URL

This error occurs when an attribute that requires a URL is missing it, for example, an empty href or src attribute.

Read more

Server returned a redirection

code: REDIRECTED

Read more

Redirected article

code: REDIRECTED_ARTICLE

Read more

Server returned an error response

code: SERVER_ERROR

Read more

Stylesheet and inline style too long

code: STYLESHEET_AND_INLINE_STYLE_TOO_LONG

Read more

Stylesheet too long

code: STYLESHEET_TOO_LONG

The AMP validator throws this error when it measures the size of the styles content within <style amp-custom> to exceed the 75,000 bytes limit.

Read more

Tag excluded by tag

code: TAG_EXCLUDED_BY_TAG

Found a tag excluded by the presence of a second tag.

Read more

Tag not allowed to have siblings

code: TAG_NOT_ALLOWED_TO_HAVE_SIBLINGS

Read more

Tag required by another tag is missing

code: TAG_REQUIRED_BY_MISSING

The validator throws the TAG_REQUIRED_BY_MISSING error when it finds an extended component in the AMP document, but doesn’t find its equivalent .

Extended components must be explicitly included in the AMP document as custom elements. To fix these errors, navigate to the extended component’s reference page, copy its required script, and paste it into the AMP document .

Read more

Value set mismatch

code: VALUE_SET_MISMATCH

Found attribute containing a value not matching any other tag in the page.

Read more

Tag required but missing

code: WARNING_TAG_REQUIRED_BY_MISSING

This error happens when a tag is required by some element, but could not be found.

Read more

Wrong parent tag

code: WRONG_PARENT_TAG

Specific tags require an immediate parent (as opposed to distant ancestor). The following lists the required parent for specific tags (tag, parent):

  • !doctype requires parent tag root.
  • html requires parent tag !doctype.
  • head requires parent tag html.
  • body requires parent tag html.
  • link requires parent tag head.
  • meta requires parent tag head.
  • style amp-custom requires parent tag head.
  • style requires parent tag boilerplate (noscript).
  • noscript requires parent tag head.
  • script requires parent tag head.
  • source requires a media tag (amp-audio, amp-video, etc.).

Read more

1 Like