When doing local development with AWS SAM, I follow these steps:

scsadammsialnmoi-ctaaplp-srtuanrtti-maep=ipython3.8

However, when running the above, the following error sometimes occurred:

samcli.commands.local.cli_common.user_exceptions.ImageBuildException:Errorbuildingdockerimage:pullaccessdeniedforpublic.ecr.aws/sam/emulation-python3.8,repositorydoesnotexistormayrequire'dockerlogin':denied:Yourauthorizationtokenhasexpired.Reauthenticateandtryagain.

Running the following command resolved the error. The region may need to be adjusted for your environment:

awsecr-publicget-login-password-regionus-east-1|dockerlogin-usernameAWS-password-stdinpublic.ecr.aws

I hope this serves as a useful reference for anyone experiencing the same error.