I got the error message W292 on the Shimano SC-EN600 display and the pedals are just spinning freely on my Ranger 800FS bike with a Shimano EP6 motor and the rear wheel is not moving but the cogset is moving when I back the pedals.
Right, let's separate the two things you're describing because they're not the same fault. Officially, W292 is just:
No bicycle speed signal was detected from the speed sensor, and the maximum speed up to which assist is provided will be lower than normal - check that the speed sensor and magnet are properly installed.
That's it - a lost signal wire or a magnet that's wandered off, and it only caps your assist speed. It genuinely can't produce "pedals spin, wheel doesn't move at all." If I made that sound bigger earlier, scale it back - W292 is a side issue here, not your main problem.
What you're actually describing - pedals spinning freely forward with nothing happening at the chain/rear wheel, while the cassette still turns fine on backpedal (normal freehub behaviour, as we covered) - is the signature of an internal drive failure inside the EP6 unit itself, not anything downstream. Riders on this forum have hit exactly this on the Shimano E8000/EP8 platform: pedals started feeling sort of soft then I heard and felt a crunch and the cranks now spin freely forwards and backwards and do not engage. The diagnosis there was blunt: that's the sprag clutch gone - when healthy, the one-way clutch locks in the forward direction and freewheels in reverse; if you're getting zero engagement, the sprag elements have collapsed or sheared.
That's an internal mechanical failure of the motor's drive coupling - nothing you can fix by chasing a speed sensor. And it's not a DIY job:
Shimano won't sell spares for the clutch, so it's a full motor replacement or a third-party repair specialist - the motor needs to come apart.
Given your pedals are spinning with genuinely zero drive, get the bike to a dealer for inspection rather than chasing the W292 further - that code will likely clear or reappear on its own but it isn't your rear wheel's problem.