Just a friendly reminder to myself (and for whom it may concern): This error message tends to appear when the ASP.NET API can’t talk to the IdentityServer.
Especially tricky when using an ASP.NET API and IdentityServer4 behind a reverse proxy (like nginx). The external world might be able to talk to the IdentityServer, but the API server / container might need some additional configuration with the internal host:port of the IdentityServer.