When I hit the submit button at the end of a survey I get this error every time. I have a slightly older version of the survey (the newer version of the survey was imported from a .lss file and then modified) that does not have this problem. I have changed very little: a few different answer options, a couple of extra questions. Any idea where I should look for a cause?
I think the problem was due to not having unique values in the tid column of the tokens table. When I created the new survey I copied the structure of the tokens table in the database (because the default in limesurvey for the columns in the tokens table is varchar(255 ), and this makes the overall record size too long. I'd fixed this inoriginal survey). However, when I copied the table structure I didn't copy the primary key constraint and the AUTO_INCREMENT attribute on the tid colum. So when I reimported tokens the tid values were all 0.
I was getting the same error as the administrator trying to "generate access tokens" for newly imported token data. After generating unique values into the tid column and make tid the auto-incremented primary key, I was able to generate the access tokens, and on completion of the survey everything worked as normal.
Moral of the story: when you try to take shortcuts by doing stuff in the database, it would help to do it properly.