- Community report: https://community.kobotoolbox.org/t/xls-export-failed/23800/…4
- Sentry: https://sentry.kbtdev.org/organizations/kobo/issues/310579/
- Discussion: https://chat.kobotoolbox.org/#narrow/stream/6-Support/topic/'Export.20Failed'.20Error.20message.20when.20downloading.20data/near/68013
If the repeat group name changes across versions it will break the export. Seems to be linked all the way back to `FormPack.get_fields_for_versions()`.
```diff
--- v1.md 2021-10-26 16:50:30.000000000 -0700
+++ v2.md 2021-10-26 16:50:39.000000000 -0700
@@ -2,7 +2,7 @@
| type | name | label |
| --- | --- | --- |
-| begin_repeat | persons | Persons |
+| begin_repeat | people | People |
| text | name | What's your name? |
| integer | age | What's your age? |
| end_repeat | | |
```
Contents of `self.sections` in `Export.__init__()`:
```python
OrderedDict(
[
(
'people',
[
'name',
'age',
'_index',
'_parent_table_name',
'_parent_index',
'_submission__id',
'_submission__uuid',
'_submission__submission_time',
'_submission__validation_status',
'_submission__notes',
'_submission__status',
'_submission__submitted_by',
'_submission__tags',
],
),
(
'people repeat',
[
'_id',
'_uuid',
'_submission_time',
'_validation_status',
'_notes',
'_status',
'_submitted_by',
'_tags',
'_index',
],
),
]
)
```
You can see that only `people` is included and not `persons` although this is supposed to be for all versions. We are therefore getting this exception breaking exports:
```
Traceback (most recent call last):
File "/srv/src/kpi/kpi/models/import_export_task.py", line 135, in run
self._run_task(msgs)
File "/srv/src/kpi/kpi/models/import_export_task.py", line 676, in _run_task
export.to_xlsx(xlsx_output_file.name, submission_stream)
File "/opt/venv/src/formpack/src/formpack/reporting/export.py", line 812, in to_xlsx
for chunk in self.parse_submissions(submissions):
File "/opt/venv/src/formpack/src/formpack/reporting/export.py", line 170, in parse_submissions
formatted_chunks = self.parse_one_submission(submission)
File "/opt/venv/src/formpack/src/formpack/reporting/export.py", line 161, in parse_one_submission
return self.format_one_submission([submission.data], section)
File "/opt/venv/src/formpack/src/formpack/reporting/export.py", line 483, in format_one_submission
chunk = self.format_one_submission(
File "/opt/venv/src/formpack/src/formpack/reporting/export.py", line 352, in format_one_submission
_empty_row = self._empty_row[_section_name]
KeyError: 'persons'
```