SAM Doctor

ERROR REFERENCE

Cannot use both --resolve-s3 and --s3-bucket

The deploy was told to use SAM's managed artifact bucket (--resolve-s3) and a specific bucket (--s3-bucket) at the same time. The CLI refuses to guess which one you meant — and the second one usually arrived through samconfig.toml rather than the command line.

WHAT IT MEANS

What this error means

Flags and samconfig.toml parameters merge before validation. A config file with resolve_s3 = true (often written by sam deploy --guided) plus a pipeline that passes --s3-bucket — or the reverse — trips the conflict even though each source looks consistent on its own.

FIX

How to fix it

  1. Pick one bucket source. The managed bucket (--resolve-s3 / resolve_s3 = true) is right unless policy requires a specific bucket; then use --s3-bucket alone.
  2. Audit both sources of the merge:
    grep -n "s3_bucket\|resolve_s3" samconfig.toml
    and the pipeline's deploy command. Remove the setting from the side you are not keeping.
  3. Keep CI and laptop config environments separate in samconfig.toml so a guided run on someone's machine cannot re-introduce the conflict into the pipeline.

AUTOMATE THE TRIAGE

Diagnose this automatically

SAM Doctor recognizes the conflict message (high confidence). Runs locally; no AWS access, no log upload.

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

RELATED