That error is related to the G140/G141. You have it in the wrong place.
This is the correct order for G13/G14/G140/G141
Code:
$TEST.MIN%
(TURRET A PROGRAM)
(LEFT CHUCK & TURRET A)
G13
G140
(DO SOME MACHINING HERE)
(RIGHT CHUCK & TURRET A)
G141
(DO SOME MACHINING HERE)
(TURRET B PROGRAM)
(LEFT CHUCK & TURRET B)
G14
G140
(DO SOME MACHINING HERE)
(RIGHT CHUCK & TURRET B)
G141
(DO SOME MACHINING HERE)
M02
all of this goes in one program and the machine will split it into 2 programs for turret A and turret B. turret B program starts at G14