A flag that works on one machine and errors on another is often a different curl build.
curl -V | grep -E '^(Protocols|Features)'
Capital -V prints the curl and libcurl versions, the TLS library, and two lists: protocols such as ftp and sftp, and features such as HTTP2, HTTP3, brotli and zstd. When an option is rejected with “the installed libcurl version doesn’t support this”, the list shows why. Distro packages, Homebrew and the curl inside a Docker image can differ a lot. The first line also names the TLS library, such as OpenSSL or GnuTLS, which matters for flags like --tlsv1.3.
Further reading: curl manual