ODK Briefcase error "Document has no Root Element"

1. What is the problem? Be very detailed.
I am trying to export data using ODK Briefcase but I am unable to do so. I have tried using version 1.17.2 but the export fails to proceed. I then tried using version 1.16-beta but it fails when it gets to 50%. My form contains multiple repeat groups and multiple selects that I suspect might be the reason for the error.

2. What app or server are you using and on what device and operating system? Include version numbers.
I am using Windows Server 2012 R2

3. What you have you tried to fix the problem?
I have tried to reduce the number of submissions but this doesn't help. I have also checked the metadata.json but this seems to be okay too

4. What steps can we take to reproduce the problem?
Use a form with multiple repeat groups
5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.

Below is the error from the logs :
indent preformatted text by 4 spaces
2020-01-23 04:29:36,081 [Thread-6] INFO org.javarosa.core.model.FormDef - Dynamic select question has no choices! [instance(Minor_Category_1)/root/item]. If this occurs while filling out a form (and not while saving an incomplete form), the filter condition may have eliminated all the choices. Is that what you intended?
2020-01-23 04:29:36,083 [Thread-6] INFO org.javarosa.core.model.FormDef - Dynamic select question has no choices! [instance(Minor_Category_2)/root/item]. If this occurs while filling out a form (and not while saving an incomplete form), the filter condition may have eliminated all the choices. Is that what you intended?
2020-01-23 04:29:36,102 [Thread-6] INFO org.javarosa.core.model.FormDef - Dynamic select question has no choices! [instance(Minor_Category_3)/root/item]. If this occurs while filling out a form (and not while saving an incomplete form), the filter condition may have eliminated all the choices. Is that what you intended?
2020-01-23 04:29:36,103 [Thread-6] INFO org.javarosa.core.model.FormDef - Dynamic select question has no choices! [instance(Power_Category_2)/root/item]. If this occurs while filling out a form (and not while saving an incomplete form), the filter condition may have eliminated all the choices. Is that what you intended?
2020-01-23 04:29:59,896 [ForkJoinPool-2-worker-9] ERROR o.o.b.export.SubmissionParser - Can't parse submission
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: Premature end of file.
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(Unknown Source)
at org.opendatakit.briefcase.export.SubmissionParser.parseAttribute(SubmissionParser.java:162)
at org.opendatakit.briefcase.export.SubmissionParser.readSubmissionDate(SubmissionParser.java:151)
at org.opendatakit.briefcase.export.SubmissionParser.lambda$getListOfSubmissionFiles$0(SubmissionParser.java:88)
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source)
at java.util.Iterator.forEachRemaining(Unknown Source)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.ReferencePipeline.forEach(Unknown Source)
at org.opendatakit.briefcase.export.SubmissionParser.getListOfSubmissionFiles(SubmissionParser.java:85)
at org.opendatakit.briefcase.export.ExportToCsv.export(ExportToCsv.java:82)
at org.opendatakit.briefcase.export.ExportToCsv.export(ExportToCsv.java:58)
at org.opendatakit.briefcase.ui.export.ExportPanel.lambda$export$7(ExportPanel.java:204)
at org.opendatakit.briefcase.reused.job.Job.lambda$run$0(Job.java:54)
at org.opendatakit.briefcase.reused.job.Job.lambda$thenRun$7(Job.java:123)
at org.opendatakit.briefcase.reused.job.Job.lambda$thenRun$7(Job.java:122)
at org.opendatakit.briefcase.reused.job.JobsRunner.lambda$launchAsync$1(JobsRunner.java:65)
at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(Unknown Source)
at java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(Unknown Source)
at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
2020-01-23 04:29:59,900 [ForkJoinPool-2-worker-9] WARN o.o.briefcase.export.ExportToCsv - A submission has been excluded from the export output due to some problem (parsing error). If you didn't expect this, please ask for support at https://forum.getodk.org/c/support
2020-01-23 04:30:00,823 [ForkJoinPool-2-worker-9] ERROR o.o.briefcase.reused.job.JobsRunner - Error running Job
java.lang.RuntimeException: java.lang.RuntimeException: Document has no root element!
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.util.concurrent.ForkJoinTask.getThrowableException(Unknown Source)
at java.util.concurrent.ForkJoinTask.reportException(Unknown Source)
at java.util.concurrent.ForkJoinTask.invoke(Unknown Source)
at java.util.stream.ForEachOps$ForEachOp.evaluateParallel(Unknown Source)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.ReferencePipeline.forEach(Unknown Source)
at java.util.stream.ReferencePipeline.collect(Unknown Source)
at org.opendatakit.briefcase.export.ExportToCsv.export(ExportToCsv.java:106)
at org.opendatakit.briefcase.export.ExportToCsv.export(ExportToCsv.java:58)
at org.opendatakit.briefcase.ui.export.ExportPanel.lambda$export$7(ExportPanel.java:204)
at org.opendatakit.briefcase.reused.job.Job.lambda$run$0(Job.java:54)
at org.opendatakit.briefcase.reused.job.Job.lambda$thenRun$7(Job.java:123)
at org.opendatakit.briefcase.reused.job.Job.lambda$thenRun$7(Job.java:122)
at org.opendatakit.briefcase.reused.job.JobsRunner.lambda$launchAsync$1(JobsRunner.java:65)
at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(Unknown Source)
at java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(Unknown Source)
at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
Caused by: java.lang.RuntimeException: Document has no root element!
at org.kxml2.kdom.Document.getRootElement(Unknown Source)
at org.opendatakit.briefcase.export.XmlElement.of(XmlElement.java:63)
at org.opendatakit.briefcase.export.SubmissionParser.lambda$parseSubmission$4(SubmissionParser.java:123)
at java.util.Optional.flatMap(Unknown Source)
at org.opendatakit.briefcase.export.SubmissionParser.parseSubmission(SubmissionParser.java:122)
at org.opendatakit.briefcase.export.ExportTools.lambda$getValidSubmissions$0(ExportTools.java:30)
at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.util.stream.ForEachOps$ForEachTask.compute(Unknown Source)
at java.util.concurrent.CountedCompleter.exec(Unknown Source)
... 4 common frames omitted

Hi, @Derrick_Nyakiba!

It looks like you have some broken/incomplete submissions in your storage directory. In your case, it looks like the submission can be parsed but Briefcase gets a document without a root element (maybe empty?). In any case, you should have some file in a {form name} - errors subdirectory at the export location. Could you check this, please? You should find the broken submissions there.

1 Like

Hi @ggalmazor,

There is a file in the {form name} - errors directory but it is completely empty

There is a file in the {form name} - errors directory but it is completely empty

That means that you have an empty submission in the form you're trying to export. That shouldn't prevent you from getting a partial export of your data. The error you're getting would be just informative, to let you know what's happening. In other words, if you have 100 submissions and one of them is empty, you should still get an export with 99 rows in it.

1 Like