ODK ERROR: UNMATCHED BEGIN OR END GROUPS
ODK common errors and solutions

Error uploading form: The form definition could not be processed: [row : #] Unmatched end statement. Previous control type: None, Control type: group

or

Error uploading form: The form definition could not be processed: [row : #] Unmatched begin statement. Previous control type: None, Control type: group

Have you received this error while using ODK? SurveyCTO is here to help!

What does this error mean?

You have received this error because the total number of begin group/begin repeat rows in your form does not match the total number of end group/end repeat rows. Group rows must always be in pairs: every ‘begin group’ must have an ‘end group’ row to close the group, and every ‘begin repeat’ row must have an ‘end repeat’ row that corresponds to it to close the repeat group. And the way ODK-based tools work is that they just check the total number of ‘begin group’ (or ‘begin repeat’) rows in your form and the total number of ‘end group’ (or ‘end repeat’) rows and confirm if the totals are the same. If they are not, you will get one of these errors. If there are more ‘end group’ rows than ‘begin group’ rows, you will get an error that there is an unmatched end group. If there are more ‘begin group’ rows than ‘end group’ rows, you will get an error that there is an unmatched begin group.

In rare cases, you can also get this error if the total number of begin/end rows are the same but the order in which they are placed is illogical or impossible. For example:

begin repeat[1]
begin group[2]
    begin group[3]
  end group[2]
end repeat[1]
end group[?]


How do I fix this error?

  1. Open your XLSForm definition in Excel.

  2. Click the ‘filter’ option in the Excel menu to add filters to the top row of your file.

  3. Click the filter icon next to the ‘type’ column in the ‘survey’ tab of the XLSForm definition and then choose to filter down to the rows that have ‘begin group’, ‘end group’, ‘begin repeat’, and ‘end repeat’ as the field type.

  4. Count the numbers of each of the ‘begin group’ and ‘end group’ row types to see if the numbers match.

  5. If you find that the numbers don’t match, go through the sequence of your group rows to find where you forgot to place a begin group, end group, begin repeat, or end repeat row and add it in, so that the totals match and the rows are all in the sequence you intended.

  6. If you find that the numbers do match, then check the following:

    Do any of the group rows have typos? For example, are any rows named ‘Begin group’ [capital B, instead of lower case b] or ‘end_repeat’ [accidental underscore between the two words]? Otherwise, is there a space before “begin” or “end”? Those incorrect names would not register as official field types.

    If you look under the ‘disabled’ column in your XLSForm definition, are any of these rows disabled because of a ‘yes’ under that column on the ‘survey’ sheet? Often, users will accidentally type a yes under the disabled column. Doing so is the same as deleting that row, so according to your platform, that row does not exist. Make sure that for every begin group field you have disabled, you have also disabled a matching end group field. Or if the disabling was accidental, remove the ‘yes’ from the disabled column to enable the field again. (Consider hiding or deleting ‘disabled’ if you don’t use it to avoid confusion.)

    Does the placement of all the group rows make sense? Or do you have illogical sequences like begin repeat – begin group – begin group – end group – end repeat – end group?

Pro tip:

Use spreadsheet formulas to count your ‘begin group’, ‘end group’, ‘begin repeat’, and ‘end repeat’ rows for you! Excel’s COUNTIF() function (also available in Google Sheets) can do this for you. For example, =COUNTIF(B2:B,”begin group”). Note that this formula would miss typos (e.g. a space before or after “begin group”). However, in long form design, it might be faster to find your typos and fix those to get your formulas working, rather than manually counting every group.


We hope you found this helpful. Feel free to browse through our other ODK error guides. To try SurveyCTO for yourself, and see all the improvements we made to ODK, you can sign up for a free 15-day trial. We offer 24×7 support from research experts, customizable form designs, smart data quality controls, and best-in-class data security.

More solutions to ODK errors

SurveyCTO vs ODK

Sign up for a free SurveyCTO trial

Close Menu