queue2 thinks it's restricting scheduling modes, but actually it isn't
When not using a temporary file, queue2 tries to prevent pull mode scheduling (see gst_queue2_handle_src_query, but this has no effect as it has no way to remove the scheduling modes already set on the query. Most uses of gst_query_set_scheduling() act as if it removes scheduling modes from the query, but the one in souphttpsrc doesn't.
To back up a bit, playbin uri=sftp://.../file.mp3 doesn't work with gstreamer 1.18 (since commit b87f8307) as giosrc will do push or pull mode, and uridecodebin decides it needs a queue2 since the uri matches its list of stream prefixes. The pipeline tries to activate in pull mode and ends up with these errors:
(gst-launch-1.0:191372): GStreamer-CRITICAL **: 14:12:21.412: pushing on pad typefind:src but it was not activated in push mode
(gst-launch-1.0:191372): GStreamer-WARNING **: 14:12:21.412: Trying to join task 0x55f86e3e9170 from its thread would deadlock. You cannot change the state of an element from its streaming thread. Use g_idle_add() or post a GstMessage on the bus to schedule the state change from the main thread.
and then sometimes issues some misleading messages about missing plugins.
You don't need sftp to see this, you can just do filesrc ! queue2 ! decodebin ! fakesink (which fails) and then replace filesrc with pushfilesrc to see it work properly.
I'm really not sure how to fix this properly, but adding gst_structure_remove_field (structure, "modes"); in gst_query_set_scheduling works.