SAM Doctor

ERROR REFERENCE

A tag key or value was rejected by validation

The tag set was rejected before the resource was touched. This is a template problem, not a permissions one — which is good news, because it is fixed entirely in your own files with no policy change.

WHAT IT MEANS

What this error means

The API validated the submitted tags and refused one of them:

1 validation error detected: Value 'aws:team' at 'tags.1.member.key'
failed to satisfy constraint: Member must satisfy regular expression pattern

The useful part is the path, tags.1.member.key. The index tells you which tag in the set failed and whether the problem is the key or the value, which is usually faster than re-reading the whole template. Two causes account for nearly all of these:

Because validation happens before any resource work, nothing was partially created — re-running after the fix is safe.

FIX

How to fix it

  1. Read the index in the errortags.N.member.key or .value — and find that tag in the template's Tags block, the Globals section, or the tag list in samconfig.toml. Remember tags can be inherited from more than one of those places.
  2. Rename any key using the reserved aws: prefix. If the intent was to mirror an AWS-generated tag, use a distinct prefix of your own instead.
  3. Check the key and value against the tag restrictions — length limits and the allowed character set. Where a value is interpolated from build metadata, constrain or sanitize it rather than passing a branch name or commit subject through unchanged.
  4. Re-run the deployment. Validation runs before any resource is created, so no cleanup or stack repair is needed first.

AUTOMATE THE TRIAGE

Diagnose this automatically

SAM Doctor recognises a rejected tag key or value and points at the index in the error (medium confidence), separating it from the permission failure it superficially resembles. Runs locally; no AWS access, no log upload.

python -m pip install sam-doctor
sam-doctor diagnose deployment.log --format markdown

RELATED