You may see this error when trying to configure a Cyclone® III LS device if the device has been configured previously via Passive Serial (PS) or Active Serial (AS). The reason you are seeing this error is because the Cyclone III LS device was designed with security in mind so the device will only allow mandatory JTAG 1149.1 instructions after the device has been configured and after POR. These instructions are BYPASS, SAMPLE/PRELOAD, EXTEST and FACTORY.
To enable the access of other JTAG instructions, issue the FACTORY instruction. The FACTORY instruction puts the device in a state in which it is ready for in-house testing and board-level testing and it must be executed before configuration starts. When this instruction is executed, the CRAM bits content and volatile key are cleared and the device is reset.
For more information about the JTAG binary instruction code, refer to IEEE 1149.1 (JTAG) Boundary-Scan Testing for Cyclone III Devices (PDF).