Skip to main contentSkip to navigationSkip to main content
LimeSurvey troubleshooting

LimeSurvey LSS Import 500 Database Error, Explained

A 500 database error during LSS import — with the survey and questions created but answer options missing — almost always means the answers insert failed. The two verified causes: answer codes longer than LimeSurvey's 5-character column, and multiple-choice options placed in the wrong table.

Inspect an LSS fileRegenerate a clean LSS

Why the survey half-imports

LimeSurvey's importer walks the LSS file table by table: surveys → groups → questions → subquestions → answers → conditions. Inserts are not wrapped in one transaction. When an answers row violates a database constraint, the import aborts at that point — after the survey, groups, questions, and subquestions are already stored. The result is the exact symptom users report: the survey exists, the questions exist, and every answer list is empty.

Causes and fixes

SymptomRoot causeFix
500 error; survey + questions created; options missinganswers.code exceeds the 5-character column limit ("Data too long for column 'code'")Shorten answer codes to ≤5 alphanumeric characters (or let a converter fall back to ordinal codes)
Import "succeeds" but multiple-choice questions are emptyType M options were written to the answers table; LimeSurvey expects them as subquestionsRegenerate the LSS with options emitted as subquestions with the parent's type
Answer text blank on LimeSurvey 6File carries answer text only in answers.answer, but LimeSurvey 6 reads answer_l10ns when that section existsUse a LimeSurvey 6 layout: answers rows plus matching answer_l10ns rows with aligned aid values
Import rejected for older LimeSurveyDBVersion / table layout newer than the installed LimeSurvey generationExport a legacy-layout LSS (answer text inline in answers.answer with a language column)

The 5-character limit comes straight from the LimeSurvey schema: the answers table defines code as string(5) NOT NULL, with an index on qid + code + scale_id. AI-generated or hand-written files that use descriptive codes like option_one hit this immediately.

Verification checklist before import

  1. Every answer option code is 1–5 alphanumeric characters.
  2. Multiple-choice (M) questions have their options as subquestions rows whose type matches the parent question.
  3. On LimeSurvey 6 layouts, each answers row has a matching answer_l10ns row with the same aid.
  4. Question and group counts match the source questionnaire.
  5. Import into a test survey and preview every choice question before production use.

LSS 500 Error FAQ

The LSS import is not transactional. LimeSurvey inserts groups, then questions, then subquestions, then answers in sequence. If the answers step hits a database error, everything inserted before it stays — so you get a survey with questions but no answer options.

"Data too long for column 'code'": the answers.code column in LimeSurvey is a 5-character string (string(5) NOT NULL in the official schema). Any answer option code longer than 5 characters fails the insert under strict SQL mode.

LimeSurvey stores multiple-choice (type M) options in the subquestions table, not the answers table. The importer inserts orphaned answers rows without complaining, but the survey editor never shows them — the question simply appears empty.

Run it through an LSS inspector: confirm every choice question has options in the right table, answer codes are 5 characters or fewer, and question counts match the source questionnaire. Then import into a non-critical survey first.