There are few possibility that causes this error, can you check the following?
 Can you check if you are selecting the correct configuration scheme, device OPN in Quartus design?
 Can you change TCK frequency to 6MHz?
Can you please elaborate further so that i can get a full picture on this scenario?
May i know what configuration scheme you are using? Have you tried to program with a SOF file? When you mention about sometimes JTAG cant connect. What does this mean? Please elaborate.