I recently came across an issue with one of the forms I am working on. The form worked find but when syncing I received the message
Internal Error Please submit a bug report
Looking at the log file output on the device
opendatakit/default/logging folder I was able to find a more informative error message
E/ProcessRowDataPushLocalChanges: 2021-02-03 13:37:03.166 Exception in synchronizeTable - pushing data up to server on table: Visit2_v2 exception: via RemoteException on IDbInterface: org.opendatakit|java.lang.IllegalStateException: Requested column: 157 has two or more data types in it
After a bit more digging I realised that one of my columns which was defined as a
number type and populated using a calculation formula was causing issue - a mistake in the calculation would sometimes result in assigning a string value instead, which still saved to the database. Therefore when syncing sqlite detected a mix of both
The issue is now resolved but I thought it might be useful information in case anybody else has similar problems. The way I figured out which column was causing the issues was to export a csv and number them (in this case the 157th column). I’m wondering if it might be possible to also include the name of the column from its ID number for the error logging in a future update?
I also did some further digging to try and understand how this can happen, and realised that the column types in
sqlite on the device aren’t as strict as they are in
postgres on the server (section 3 of Datatypes In SQLite Version 3 explains how the type is essentially a recommendation for the data stored but not a restriction). There are some ways to prevent this using Check contrataints, but for now I’m happy to just pay closer attention to my calculations!