The Camera crashes with the error below whenever I try to apply a Media3Effect in PREVIEW or VIDEO_CAPTURE mode. Applying the effect to either mode works, but using it together kills the Camera.

And here's my code to bind the camera
suspend fun bindToCamera(applicationContext: Context, lifecycleOwner: LifecycleOwner) {
    currentCameraProvider?.unbindAll()
    currentCameraProvider = ProcessCameraProvider.awaitInstance(applicationContext)
    var primaryCameraSelector: CameraSelector? = null
    var secondaryCameraSelector: CameraSelector? = null
    for (cameraInfos in currentCameraProvider!!.availableConcurrentCameraInfos) {
        primaryCameraSelector =
            cameraInfos.firstOrNull { it.lensFacing == CameraSelector.LENS_FACING_BACK }?.cameraSelector
        secondaryCameraSelector =
            cameraInfos.firstOrNull { it.lensFacing == CameraSelector.LENS_FACING_FRONT }?.cameraSelector
        if (primaryCameraSelector != null && secondaryCameraSelector != null) {
            break // Found both, stop searching
        } else {
            primaryCameraSelector = null
            secondaryCameraSelector = null
        }
    }
    if (primaryCameraSelector == null || secondaryCameraSelector == null) return
    val effect = Media3Effect(
        applicationContext,
        PREVIEW or VIDEO_CAPTURE,
        applicationContext.mainExecutor
    ) {
        Log.e("DualCameraSingleVideoUseCase", "Applying media3effect failed with", it)
    }
    val resolutionSelector = ResolutionSelector.Builder().setAspectRatioStrategy(
        AspectRatioStrategy.RATIO_16_9_FALLBACK_AUTO_STRATEGY
    ).build()
    val preview = Preview.Builder().setResolutionSelector(resolutionSelector).build()
    preview.setSurfaceProvider { newSurfaceRequest ->
        _mSurfaceRequest.update { newSurfaceRequest }
    }
    val recorder = Recorder.Builder().setQualitySelector(
        QualitySelector.from(Quality.HD)
    ).build()
    videoCapture = VideoCapture.withOutput(recorder)
    effect.setEffects(listOf(Contrast(0.5f)))
    val useCaseGroup = UseCaseGroup.Builder()
        .addUseCase(preview)
        .addUseCase(videoCapture!!)
        .addEffect(effect)
        .build()
    val primary = SingleCameraConfig(
        primaryCameraSelector,
        useCaseGroup,
        CompositionSettings.Builder()
            .setAlpha(1.0f)
            .setOffset(0.0f, 0.0f)
            .setScale(1.0f, 1.0f)
            .build(),
        lifecycleOwner
    )
    val secondary = SingleCameraConfig(
        secondaryCameraSelector,
        useCaseGroup,
        CompositionSettings.Builder()
            .setAlpha(1.0f)
            .setOffset(0.65f, -0.7f)
            .setScale(0.25f, 0.25f)
            .build(),
        lifecycleOwner
    )
    currentCameraProvider?.bindToLifecycle(listOf(primary, secondary))
    try {
        awaitCancellation()
    } finally {
        currentCameraProvider!!.unbindAll()
    }
}