In SWI-Prolog, current_output is a stream alias for the default output stream. Surely stream_property(Response, write) is not going to work as it will pick some arbitrary stream opened for writing. There is also the current_output/1 that is available in several Prolog systems. It also exists in SWI-Prolog, but given current_output you hardly ever need it.