# Internal Server Error (Requested column has two or more data types in it)

**URL:** <https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098>\
**Category:** Support\
**Tags:** odk-x-sync-endpoint\
**Created:** [February 4, 2021, 3:33am UTC](https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098 "2021-02-04T03:33:54Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrismclarke](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/chrismclarke/32/367_2.png) [@chrismclarke](https://forum.odk-x.org/u/chrismclarke)\
**Post date:** [February 4, 2021, 3:33am UTC](https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098/1 "2021-02-04T03:33:54Z")

</div>

Hi,

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

```auto
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

```auto
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 `real` and `text` data.

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](https://www.sqlite.org/datatype3.html) 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](https://www.sqlitetutorial.net/sqlite-check-constraint/), but for now I’m happy to just pay closer attention to my calculations!

---

<div class="post-metadata">

**Author:** ![aortegon](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/aortegon/32/299_2.png) [@aortegon](https://forum.odk-x.org/u/aortegon)\
**Post date:** [February 16, 2021, 3:29am UTC](https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098/2 "2021-02-16T03:29:55Z")

</div>

I have the same problem, but when importing, not when syncing.  
It’s very courious, because the error message in the log file es ever the same: org.opendatakit|java.lang.IllegalStateException: Requested column: 16 has two or more data types in it.  
My table have 53 columns. I have started trying to import alls columns, but I have tryed also with less and less columns; last time I try to import only 11 columns, but the messsage is allways the same: “E/simpleQuery: 2021-02-16 02:57:46.273 org.opendatakit|java.lang.IllegalStateException: Requested column: 16 has two or more data types in it dbHandle: uuid:ab9787b4-f61c-4da2-bd8a-4f035bae0846”

I don’t understand what’s the problem! Survey works well, and Tables also, but the import process, even obtaining the success message, only produce nulls rows, or no helth rows that provoque Tables to close, and Survey to show the illegal exception …

 ![Screenshot_20210216-030359](https://odkx.b-cdn.net/uploads/default/original/1X/d693864a8fe48c9d9a021e9f26cb761fb93cb1af.png)

---

<div class="post-metadata">

**Author:** ![elmps2018](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/elmps2018/32/105_2.png) [@elmps2018](https://forum.odk-x.org/u/elmps2018)\
**Post date:** [February 16, 2021, 3:55am UTC](https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098/3 "2021-02-16T03:55:44Z")

</div>

Hi @aortegon! This error message does suggest that what you are importing might have some data conflicts. Can you share the data you are trying to import and your form? The column 16 is probably counting in the table so it could be in a different order than what you import.

---

<div class="post-metadata">

**Author:** ![aortegon](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/aortegon/32/299_2.png) [@aortegon](https://forum.odk-x.org/u/aortegon)\
**Post date:** [February 16, 2021, 10:57am UTC](https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098/4 "2021-02-16T10:57:38Z")

</div>

Thanks Caroline! You are always ready to answer, I’, very gratefull with you!

Yes, off course, I can share the data and forms:  
efr.xlsx is the mean form  
agrega\_titular.xlsx is a subform, a linked\_table of efr  
efr.imp21.csv, and efr.imp22.csv are the last two versions of the file I try to import.  
I start with a health table, with only 3 instances, that I can see perfectly in both, the List View ant the Detail View.  
In the tables screen manager I pick the file to import, and I obtain the success message.  
When I try to access the table, the List View don’t show anything; opening Survey and accessing the form produce the error message you can see (the java.lang.IllegalStateException)Uploading:  
config.zip…

I send you the entire config folder of my PC, with an extra assets/csv/ folder in wihich I put the csv files to import.

You say “The column 16 is probably counting in the table so it could be in a different order than what you import.” How can I know exactly what’s the referred column?

Thanks @elmps2018

---

<div class="post-metadata">

**Author:** ![elmps2018](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/elmps2018/32/105_2.png) [@elmps2018](https://forum.odk-x.org/u/elmps2018)\
**Post date:** [February 16, 2021, 4:22pm UTC](https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098/5 "2021-02-16T16:22:12Z")

</div>

Hi @aortegon! The upload doesn’t seem to have worked quite right, it says uploading:…

But in terms of the column, tables defaults to alphabetizing unless you tell it otherwise. And your import may have meta-data columns so not sure how the column numbers would exactly map. As well as deleting columns when there are problem imports I often delete rows. Try importing with just one row and see if the error occurs, then maybe half the data and divide in halves further to figure out which row has the problem.

---

<div class="post-metadata">

**Author:** ![aortegon](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/aortegon/32/299_2.png) [@aortegon](https://forum.odk-x.org/u/aortegon)\
**Post date:** [February 16, 2021, 4:46pm UTC](https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098/6 "2021-02-16T16:46:36Z")

</div>

Hi @elmps2018, thanks!!  
“Try importing with just one row and see if the error occurs…” the files I have send you contain just one row, and a minimum number of columns. I have started with all columns (53) and a fews rows (59); after see the problems, I have cutted the number of rows, first at 3 rows, and after just only 1; because the problems persist, I have eliminate more and more columns; if you see the files I try to import (“efr.imp22.csv”), it has only 1 row to import, and only some columns.

---

<div class="post-metadata">

**Author:** ![elmps2018](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/elmps2018/32/105_2.png) [@elmps2018](https://forum.odk-x.org/u/elmps2018)\
**Post date:** [February 16, 2021, 7:24pm UTC](https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098/7 "2021-02-16T19:24:33Z")

</div>

Hi @aortegon! Unfortunately I am not seeing the files. Can you please try uploading just as .csv and .xlsx for the form and the csv you are trying to import?

---

<div class="post-metadata">

**Author:** ![aortegon](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/aortegon/32/299_2.png) [@aortegon](https://forum.odk-x.org/u/aortegon)\
**Post date:** [February 17, 2021, 12:12am UTC](https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098/8 "2021-02-17T00:12:21Z")

</div>

Yes, off course!!  
I was thinked that it would be better if I compress its!

[efr.xlsx](https://forum.odk-x.org/uploads/short-url/isA3YjoHHXWSIXepHBYWU97kxvd.xlsx) (39.6 KB) [agrega\_titular.xlsx](https://forum.odk-x.org/uploads/short-url/cpmwQ6tR66Fys2igHcQEosHevhb.xlsx) (18.4 KB) [framework.xlsx](https://forum.odk-x.org/uploads/short-url/A4EkMb5s3t2xGGpW1kdiqBiPRF0.xlsx) (135.2 KB) [efr.imp21.csv](https://forum.odk-x.org/uploads/short-url/cnWP3lu70CvXhphVmYRa4iX6Wbr.csv) (231 Bytes) [efr.imp22.csv](https://forum.odk-x.org/uploads/short-url/vRr20aC8zUVA2wpiryubRVvC44F.csv) (239 Bytes)

---

<div class="post-metadata">

**Author:** ![aortegon](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/aortegon/32/299_2.png) [@aortegon](https://forum.odk-x.org/u/aortegon)\
**Post date:** [February 17, 2021, 4:13pm UTC](https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098/9 "2021-02-17T16:13:38Z")

</div>

I have see that in my efr.xlsx, the fiel causing the import problem is “aviso\_legal”; I dont know why, it’s a acknowledge type field; when I import without this field, the process end with success, and I can see the instances in the spreadsheet view as well as in the List view… but if try then export, I obtain an empty file… grrrr

Note.- The field “aviso\_legal” is the first data my survey take; it’s placed at the 4 row of efr.xlsx

---

<div class="post-metadata">

**Author:** ![elmps2018](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/elmps2018/32/105_2.png) [@elmps2018](https://forum.odk-x.org/u/elmps2018)\
**Post date:** [February 17, 2021, 5:29pm UTC](https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098/10 "2021-02-17T17:29:49Z")

</div>

I am not sure what the underlying issue is with the aviso\_legal preload is, but one guess is that it may be caps (true vs. TRUE) or how the acknowledge field records that makes a contradiction. If you can push your survey and fill it in without an import then you may be able to export and see how aviso\_legal should preload.

Otherwise an easy workaround is to change the acknowledge prompt to a select\_one but make it have only one choice (yes). We’ve done that before. Then just preload with that value. That might solve your import causing a two data types problem at least. I am not sure for the export why your file would be empty though… you do have to export-table-by-table if that’s an issue.

---

<div class="post-metadata">

**Author:** ![aortegon](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/aortegon/32/299_2.png) [@aortegon](https://forum.odk-x.org/u/aortegon)\
**Post date:** [February 17, 2021, 8:39pm UTC](https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098/11 "2021-02-17T20:39:57Z")

</div>

Thanks Caroline!  
I was see that aviso\_legal values are “true”, so, this is the value I employ to load its instances.  
To avoid the problem I just think almost exactly what you suggest me: I have changed the acknowledge type to select\_multiple with only one option (to emulate the behaviour of acknowledge type, with a checkbox). It will be interesting know whats the issue here… but at least, I dont have the problem with aviso\_legal!!

---

<div class="post-metadata">

**Author:** ![W\_Brunette](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/w_brunette/32/376_2.png) [@W\_Brunette](https://forum.odk-x.org/u/W_Brunette)\
**Post date:** [February 18, 2021, 2:11am UTC](https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098/12 "2021-02-18T02:11:01Z")

</div>

Are you using Microsoft Excel to modify your CSV? The reason I ask is when Excel converts CSV to XLSX it will changes the values originally in the CSV to it’s representation of boolean values instead of the string value.

---

<div class="post-metadata">

**Author:** ![aortegon](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/aortegon/32/299_2.png) [@aortegon](https://forum.odk-x.org/u/aortegon)\
**Post date:** [February 18, 2021, 2:37am UTC](https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098/13 "2021-02-18T02:37:54Z")

</div>

Ooooook!!! Thanks @W_Brunette !!  
Yer, I using excel, and it semm it’s the reason; excel introduce also others problems:

- depends on your regional configuration, as in my case, excel change the field separator from the original “,” to “;”
- I have also a non desired behaviour with spanish letters like “á”, “é”… or “ñ” (I dont know if the problem is excel-related or ODK-X internal process related.  
And, probably also from excel, I have another problem that affect the export process: I have reach to import a few instances, but it’s no possible to export them… ¿? The process start but Tables crash, and demand re-start or close, without havin exported anything.

---

<div class="post-metadata">

**Author:** ![aortegon](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/aortegon/32/299_2.png) [@aortegon](https://forum.odk-x.org/u/aortegon)\
**Post date:** [February 18, 2021, 3:14am UTC](https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098/14 "2021-02-18T03:14:42Z")

</div>

I have just see that the problem with spanish letters is only a question of codification: converting to UTF-8 solve this issue… but the problem concerning export a table with rows previously imported persisted. I see also that Survey can’t manage theses instances… it never end to start: permanently show the “Wait…” message, so, it’s no possible to edit its.

---

<div class="post-metadata">

**Author:** ![W\_Brunette](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/w_brunette/32/376_2.png) [@W\_Brunette](https://forum.odk-x.org/u/W_Brunette)\
**Post date:** [February 18, 2021, 3:34am UTC](https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098/15 "2021-02-18T03:34:49Z")

</div>

I have found people who use spanish languages have lots of problems with Excel. I suggest using Libre Calc. It’s free and like Excel, but does better maintaining UTF-8.

> **[Calc | LibreOffice - Free Office Suite - Based on OpenOffice - Compatible...](https://www.libreoffice.org/discover/calc/)**
>
> LibreOffice, Calc, spreadsheet, ODF, open standards

---

<div class="post-metadata">

**Author:** ![aortegon](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/aortegon/32/299_2.png) [@aortegon](https://forum.odk-x.org/u/aortegon)\
**Post date:** [February 18, 2021, 7:39am UTC](https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098/16 "2021-02-18T07:39:06Z")

</div>

Thanks a lot Waylon!!

---

<div class="post-metadata">

**Author:** ![aortegon](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/aortegon/32/299_2.png) [@aortegon](https://forum.odk-x.org/u/aortegon)\
**Post date:** [February 18, 2021, 8:59am UTC](https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098/17 "2021-02-18T08:59:29Z")

</div>

@elmps2018 and @elmps2018 , for your information, I have tryed export generating the file with Libre Office-Calc. The result is exactly equal: I obtain the definition and properties file, and also the data folder and the data file, but the data file is empty.  
The imported instances can’t be managed by Survey, so I can’t edit any of theses instances; I can’t export, and I can’t Synchronize… so, the imported instances have not value!!  
When syncing, I obtain the image message you see:

 ![Internal Error - Syncing](https://odkx.b-cdn.net/uploads/default/original/1X/b968b20a2874a7fdce93652de0fb01bd75c1804f.png)  
(message says: Internal Error. Please send an error message)  
Where we must send a message??

I attach also the screenshot produced when trying to export.![Internal Error - Syncing

 ![Tables crush - Exporting](https://odkx.b-cdn.net/uploads/default/original/1X/e0759e68de52aacbf07345c3dcbe7b5b775ba1a9.png)

---

<div class="post-metadata">

**Author:** ![elmps2018](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/elmps2018/32/105_2.png) [@elmps2018](https://forum.odk-x.org/u/elmps2018)\
**Post date:** [February 18, 2021, 7:40pm UTC](https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098/18 "2021-02-18T19:40:33Z")

</div>

Hi @aortegon! Sorry you are still having all these troubles! Let’s try to separate out the problems. If you push but DON’T import, but then just enter a new instance, can you export that data? If yes, then the problem is likely in the import file still, if no, then the problem is likely coming from the tables/forms/app in some way rather than the import. If the export works, then you can try pushing again, but with the export you did as the asset in csv (do not open or change in any way, just copy it) and see if you can import that. It will help separate out where the problem is happening.

Also I am not sure if you said, but what version of the app are you using? Just want to check on that.

---

<div class="post-metadata">

**Author:** ![aortegon](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/aortegon/32/299_2.png) [@aortegon](https://forum.odk-x.org/u/aortegon)\
**Post date:** [February 18, 2021, 11:56pm UTC](https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098/19 "2021-02-18T23:56:03Z")

</div>

Thanks another time Caroline!!  
Be quoyed, trouble is jet solved… just now, but solved!  
I have tryed with your instructions, before comment the problem here: I push my configuration, and it was possible export; I have examined the file I try import, that I have made taking into account the previously exported file. At the end, I have discover some importants reasons affecting the process:

- with my local configuration, excel separate fields with “;” and not with “,”. It was easy to discover and avoid.
- also for using excel to treat the data, thanks to @W_Brunette I realize that true or false are treated ¡and converted! to booleans, from its original string type.
- encoding is critical, at least with spanish characters like ñ, or á, and so on… I must to convert to UTF-8
- also, I have understand, after a lot of work, that a string in a select\_multiple value look like [“value”], very different of value, and causing importing problems
- and, for the last, following the documentation, I was trying to import metadata like \_savepoint\_creator,… and thanks to the resulting export file, I understand that I need to write username: before my credential.

…after all that ocurrences, and some other,and after a very big lot of attempts, I can say that I understand now a little better the import an export process!!!

Thanks a lot @elmps2018 and @W_Brunette😉

---

<div class="post-metadata">

**Author:** ![elmps2018](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/elmps2018/32/105_2.png) [@elmps2018](https://forum.odk-x.org/u/elmps2018)\
**Post date:** [February 19, 2021, 12:08am UTC](https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098/20 "2021-02-19T00:08:15Z")

</div>

@aortegon so glad you were able to work your way through the issues! I know it is extra challenging working with a variety of characters (I often work in Arabic)!

[Next page](https://forum.odk-x.org/t/internal-server-error-requested-column-has-two-or-more-data-types-in-it/1098.md?page=2)
