This is not a defect, but the sound of an IR filter that is mechanically folded in front of the lens when it is light (and folded away when it is dark).

It can happen that in dim weather, the camera will keep switching between night and day mode for a while.

As soon as it is dark enough, the camera will remain in night mode.