The filament sensor equipped on the Original Prusa MK4, Original Prusa MK3.9, and each tool of Original Prusa XL detects the presence of a filament and filament run-out. The sensor is a Hall sensor, triggered by a mechanism composed of a spring, a magnet, and a ball.
During usage, it is possible that filament residue might build up around the sensor or its mechanism, possibly causing false readings and thus malfunctioning.
At the top of the extruder is a small hole, insert the tip of a compressed air can in the hole. With your free hand, prepare a bit of filament with a non-stringy tip. Repeatedly insert and remove the filament from the extruder, while blowing the compressed air. This will dislodge the build-up debris.
Top view of the MK4 print head. The XL print head has a similarly positioned small hole.
In case you don't have compressed air at hand, a similar procedure to the one above can be attempted.
Prepare a bit of filament with a non-stringy tip. Repeatedly insert and remove the filament from the extruder. It will be necessary to insert and remove the bit of filament several times to achieve good cleaning, and the technique might not always be effective.
If the previous techniques do not work, the filament sensor can be removed to be manually cleaned. This procedure requires partial disassembly of the E-axis.