Cannot restore previous console. This is not implemented yet

I seeing tests failing (but not all) with the following exception

Caused by: java.lang.UnsupportedOperationException: Cannot restore previous console. This is not implemented yet.
	at org.gradle.internal.logging.sink.OutputEventRenderer.restore(OutputEventRenderer.java:106)

which comes roughtly from the area of the following code

The question is what would be the cause of it. I have an test listener registered which captures output, but it is pretty simple.