Don't know what the rules are for when this occurs.
Test case: gemini://cadence.moe/gemlog/
Visit there, then click any link to a post.
You'll get "failed to connect to localhost". Yes, it is actually trying to connect to localhost. Running
nc -l 0.0.0.0 1965 in Termux gets some TLS data.