Emscripten: WebGL: INVALID_ENUM: readPixels: invalid format

When using vtkOpenGLHardwareSelector one gets two errors

WebGL: INVALID_ENUM: readPixels: invalid format
and
GL_INVALID_OPERATION: Invalid format and type combination.

The errors arise from the javascript call

GLctx.readPixels(x, y, width, height, format, type, heap, pixels >> heapAccessShiftForWebGLHeap(heap))

in the generated code. This is triggered with the call to

vtkOpenGLHardwareSelector * h_sel = //...
// ...
h_sel->CaptureBuffers();

Hence the same error occurs with PickProp on a renderer

vtkRenderer *r = // ...
// ...
r->PickProp(x, y);

The same behavior is observed with vtkOpenGLRenderer.

Please note that everything was compiled in compliance with instructions on the Examples page, and that other features work correctly.

Might anyone offer some insight into what might be happening? The CaptureBuffers method of vtkHardwareSelector invokes render_window->Render() under the hood, but this method seems to work properly outside of the above.