ERROR REFERENCE
InvalidSamDocumentException (template schema validation)
SAM or CloudFormation rejected the template before creating any resource: the document failed schema validation, or a resource type does not recognize one of its properties. The template never reached AWS as a change — the shape of the file itself is the failure.
WHAT IT MEANS
What this error means
The same family shows up in several phrasings:
InvalidSamDocumentException/Invalid Serverless Application Specification document— the SAM transform rejected the document.Encountered unsupported property ...— a property the resource type does not accept.property ... not defined for resource of type ...— usually indentation putting a property at the wrong nesting level.InvalidResourceException— a resource-level rejection with the resource id named.
The most common causes are ordinary editing accidents: a property
indented into the wrong block, a copy-paste from a different resource
type, or a template that declares SAM resource types
(AWS::Serverless::*) after losing its
Transform: AWS::Serverless-2016-10-31 line.
FIX
How to fix it
-
Validate locally before deploying:
The lint pass runs cfn-lint rules and reports the resource id and property path, which is faster than a deploy round-trip.sam validate --lint - Read the resource id and property in the error. Compare that property against the reference page for the exact resource type — an unsupported property is often a valid property of a different type (a function property on a state machine, an API property on a function).
- Check the nesting level. YAML indentation moves properties between blocks silently; a property one level too deep or too shallow becomes "not defined for resource of type".
-
Confirm the Transform line survives. Templates
using
AWS::Serverless::*types needTransform: AWS::Serverless-2016-10-31at the top level.
AUTOMATE THE TRIAGE
Diagnose this automatically
SAM Doctor recognizes the schema-validation phrasings (high confidence) and keeps them distinct from single-property mismatches, which have their own rule. Runs locally; no AWS access, no log upload.
python -m pip install sam-doctor
sam-doctor diagnose deployment.log --format markdown
RELATED
Related errors
- Template exceeds a CloudFormation size or count quota — the other way a template fails before any resource exists.
- Requires capabilities : [CAPABILITY_IAM] — a valid template stopped by the IAM acknowledgement gate instead.