“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>
.
Attribute value required by layout
code: ATTR_VALUE_REQUIRED_BY_LAYOUT
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"
"@import"
"@namespace"
"@document"
"@page"
"@viewport"
CSS syntax error - bad url
code: CSS_SYNTAX_BAD_URL
Important CSS disallowed syntax
code: CSS_SYNTAX_DISALLOWED_IMPORTANT
Usage of the !important
CSS qualifier is not allowed.
CSS syntax error - disallowed media feature
code: CSS_SYNTAX_DISALLOWED_MEDIA_FEATURE
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.
CSS syntax error - incomplete declaration
code: CSS_SYNTAX_INCOMPLETE_DECLARATION
CSS syntax error - invalid at rule
code: CSS_SYNTAX_INVALID_AT_RULE
CSS syntax error - invalid declaration
code: CSS_SYNTAX_INVALID_DECLARATION
Disallowed AMP domain
code: DISALLOWED_AMP_DOMAIN
The script tag includes an invalid AMP domain in the src attribute.
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.
Disallowed child tag name
code: DISALLOWED_CHILD_TAG_NAME
DIsallowed first child tag name
code: DISALLOWED_FIRST_CHILD_TAG_NAME
Disallowed manufactured body
code: DISALLOWED_MANUFACTURED_BODY
Tag or text which is only allowed inside the body section found outside of the body section.
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">
Disallowed relative url
code: DISALLOWED_RELATIVE_URL
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.
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.
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.
Document too complex
code: DOCUMENT_TOO_COMPLEX
The document is too complex.
Duplicate attribute
code: DUPLICATE_ATTRIBUTE
Image duplicate for same dimension
code: DUPLICATE_DIMENSION
Multiple image candidates with the same width or pixel density found.
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>
Duplicate unique tag
code: DUPLICATE_UNIQUE_TAG_WARNING
Found more than once a certain tag supposed to be unique.
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’.
Validation was not possible
code: FAILED_VALIDATION
The system has not been able to validate the information in these URLs.
General disallowed tag
code: GENERAL_DISALLOWED_TAG
Found a tag that’s disallowed except in specific forms.
Incorrect minimum number of child tags
code: INCORRECT_MIN_NUM_CHILD_TAGS
Incorrect number of children tags
code: INCORRECT_NUM_CHILD_TAGS
Inline style too long
code: INLINE_STYLE_TOO_LONG
Found a tag with inline style over size limit in bytes.
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.
Invalid doctype html
code: INVALID_DOCTYPE_HTML
Invalid or missing doctype declaration. Should be ‘!doctype html’.
Invalid json
code: INVALID_JSON_CDATA
The script tag contains invalid JSON that cannot be parsed.
Invalid URL
code: INVALID_URL
This error occurs when a attribute has a URL, but the URL is invalid.
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.
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.
Mandatory last child tag
code: MANDATORY_LAST_CHILD_TAG
Mandatory attribute missing
code: MANDATORY_ONEOF_ATTR_MISSING
A tag was found missing a mandatory attribute.
Mandatory reference point missing
code: MANDATORY_REFERENCE_POINT_MISSING
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.
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.
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.
Missing layout properties
code: MISSING_LAYOUT_ATTRIBUTES
Missing required extension
code: MISSING_REQUIRED_EXTENSION
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.
Server returned a redirection
code: REDIRECTED
Redirected article
code: REDIRECTED_ARTICLE
Server returned an error response
code: SERVER_ERROR
Stylesheet and inline style too long
code: STYLESHEET_AND_INLINE_STYLE_TOO_LONG
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.
Tag excluded by tag
code: TAG_EXCLUDED_BY_TAG
Found a tag excluded by the presence of a second tag.
Tag not allowed to have siblings
code: TAG_NOT_ALLOWED_TO_HAVE_SIBLINGS
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 .
Value set mismatch
code: VALUE_SET_MISMATCH
Found attribute containing a value not matching any other tag in the page.
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.
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 tagroot
. -
html
requires parent tag!doctype
. -
head
requires parent taghtml
. -
body
requires parent taghtml
. -
link
requires parent taghead
. -
meta
requires parent taghead
. -
style amp-custom
requires parent taghead
. -
style
requires parent tagboilerplate
(noscript). -
noscript
requires parent taghead
. -
script
requires parent taghead
. -
source
requires a media tag (amp-audio
,amp-video
, etc.).