If an airliner (enroute via IFR rules) discovers a thunderstorm ahead, how much lateral deviation is allowed before a clearance from ATC needs to be obtained ? Is the width of an RNAV corridor only for navigation errors or also for intended deviations ?
4 nm from centerline or 8nm total width of airway. You are not required to instantly turn when transitioning between airways. Required navigational precision for most enroute segments is 2 nm. Being conservative and always assuming an operational error of 2nd means any observed deviation of more than 2 nm is a red flag.
Intentionally deviating within the course width is not prescribed within the regulations, but then there's no regulation prohibiting or allowing fly by (fly over is sometimes mandated).
If the aircraft is under ATC control then no deviation is allowed except in an emergency. A pilot who wants a course change would need to request it from ATC and obtain a clearance. If the flight is not under ATC control and wants to divert then it's pilot's discretion, he/she would notify ATC of the change if receiving some sort of service.