The full message error is similar to this:

Error: creating build container: unable to copy from source docker://ruby:3.3.8-slim-bullseye: copying system image from manifest list: writing blob: adding layer with blob "sha256:ccaf924377f936af2c0396fce237145b7d1ecc0b8196916667fc6d5ff4866e2d"/""/"sha256:a07f4ed3adbe9f3131e7531782871ac8e2bd4abf9faf2292dbbf24e2e5746314": unpacking failed (error: exit status 1; output: potentially insufficient UIDs or GIDs available in user namespace (requested 0:42 for /etc/gshadow): Check /etc/subuid and /etc/subgid if configured locally and run "podman system migrate": lchown /etc/gshadow: invalid argument)

And the solution is the following:

sudo usermod --add-subuids 10000-75535 $(whoami)
sudo usermod --add-subgids 10000-75535 $(whoami)
podman system migrate

📌 StackOverflow

📌 Podman Docs