The error message is a bit misleading, but points to the wrong definition of your kernel size.
Pass the size as a tuple of 3 values kernel_size=(3, 3, 3) or as a single value kernel_size=3 and it should work.