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

sam init --runtime=python3.8
cd sam-app
sam local start-api

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

samcli.commands.local.cli_common.user_exceptions.ImageBuildException: Error building docker image: pull access denied for public.ecr.aws/sam/emulation-python3.8, repository does not exist or may require 'docker login': denied: Your authorization token has expired. Reauthenticate and try again.

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

aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws

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