Getting error "Distinct, non-empty sequence of Field clauses"

Hi All,
First time poster,
I am testing Metabase at our hospital. So far managed to install and get the service running and can connect to Metabase server from a client machine browser and see admin settings, add databases, etc., and successfully added a connection to our SQL server. So far so good.
However, when I try to access any table to build a query, then I get the error “Distinct, non-empty sequence of Field clauses”.
I CAN see the database, owner, and table names. But can’t access data in any table.
I am still trying to make sense of the logs, what I can see is many lines containing “ERROR metabase.sync.util Error syncing Fields for Table [tablename]”. Seems to be for all the tables.
I am not using SSL or SSH-tunnel.
Please help.

  "browser-info": {
    "language": "en-US",
    "platform": "Win32",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36",
    "vendor": "Google Inc."
  "system-info": {
    "file.encoding": "Cp1252",
    "": "Java(TM) SE Runtime Environment",
    "java.runtime.version": "1.8.0_251-b08",
    "java.vendor": "Oracle Corporation",
    "java.vendor.url": "",
    "java.version": "1.8.0_251",
    "": "Java HotSpot(TM) Client VM",
    "java.vm.version": "25.251-b08",
    "": "Windows Server 2012 R2",
    "os.version": "6.3",
    "user.language": "en",
    "user.timezone": "Asia/Muscat"
  "metabase-info": {
    "databases": [
    "hosting-env": "unknown",
    "application-database": "h2",
    "application-database-details": {
      "database": {
        "name": "H2",
        "version": "1.4.197 (2018-03-18)"
      "jdbc-driver": {
        "name": "H2 JDBC Driver",
        "version": "1.4.197 (2018-03-18)"
    "run-mode": "prod",
    "version": {
      "tag": "v0.35.3",
      "date": "2020-04-21",
      "branch": "release-0.35.x",
      "hash": "1d424cb"
    "settings": {
      "report-timezone": null

Hi @chrisKH
That means that Metabase has problems doing it’s sync+scan with your database.

Try starting with debug logging to get more information about what is failing - example:

java -Dlog4j.configuration= -jar metabase.jar
  1. Upgrade to 0.35.4
  2. Migrate away from H2, if you’re using Metabase in production:
  3. I would recommend AdoptOpenJDK 11:

Hi flamber,
Thank you for your fast reply.
I did the following:

  • upgrade to latest Metabase version - OK
  • change to the alternative JDK bundle suggested - OK
    … so far neither of the above fixed the issue, but nonetheless I understand it is good practice
  • migrate away from H2: I’m trying to convert it to mySQL. Installed mySQL server and configured a db admin, then ran the code snippet as a .bat file including the admin credentials. Something ran, but db did not convert. Last line of error log says:

‘Command failed with exception: Could not connect to address=(host=localhost)(port=3306)(type=master) : RSA public key is not available client side (option serverRsaPublicKeyFile not set)’

Not sure what that means, hoping you can point me to the next step. (Yes I’m somewhat of a mySQL noob.)

Also, one other question: The fact that Metabase cannot scan/sync with our SQL db tables … is there anything on the SQL db side that could be causing the issue? For example, SQL version? I’m not sure but the version might be quite old. Out of interest, what versions of SQL is Metabase compatible with?

Regards and thanks again,

About the MySQL error - see this issue for workarounds:

Yes, the sync+scan could be failing because of a really old SQL Server version, but Metabase should still log about failures.
Since it’s happening to all your tables, then it could be some column type you’re using everywhere, that Metabase doesn’t recognize - it should still be logged though.

You might wanna have a look in the SQL Server’s logs - perhaps it’s giving a hint to the problem.

Metabase somewhat works with 2008, where certain functionality doesn’t work, but should be fully functional with 2012.

Hi there. I had this issue a couple monghs ago. This might be related with the metabase option to read more easily the tables. You can uncheck that option from administration menu. So when you try to consult, query or navigate trought the table, you could do it with the exact table name. Let me know if this worked for you.

Hi again,
Sorry for late reply, had to put Metabase testing on the shelf for a few days in favour of some other priorities. Anyway, back on it now.
Thanks for replying flamber and frankosn.
Turns out the server I was connecting to had old SQL version (like embarrassingly old!).
Running on SQL2016 now and Metabase connects without issue :+1:
Looking ahead at a possible production environment, and reading up more on migrating from h2 to mySQL.
Couple of questions about that:

  • for small scale (e.g. ± 2 devs and 20 dashboard viewers) is it fine to leave it as h2 inbuilt?
  • is there any particular disadvantage with h2? (stability, security, audit/logging, etc.)



You should not use H2 in production. That can have different meanings for different people. If you have very little activity, then H2 might be okay, as long as you shutdown Metabase and make a backup of the H2 file on a regular basis.

I use H2 constantly, when running test environments, but I don’t care if the database ends up corrupted, since I almost won’t lose anything and will just recreate a new test setup.

Search the forum - you will likely end up with a corrupted H2 at some point, so if you’re okay with that, and have backups to revert to, then it’s okay.
There’s also some performance issues, where H2 doesn’t scale, and the database cannot be optimized, while Metabase is running, since only a single process can write-lock the file at the same time.

TLDR; Migrate away from H2.

Thanks for your quick reply.
I’m running a windows batch file in the same folder as the current h2 database in an attempt to migrate. I have installed mySQL community on the same machine, configured the sa user, and created a db called ‘metabase’. What I have in the .bat file is as follows (broken into lines):

-jar metabase.jar load-from-h2

When I run this, I get the error about the RSA public key not being available. I looked up the workarounds at the link you provided. One of the options was to add a switch allowPublicKeyRetrieval=true. This is marked as not secure, but should not be a risk if it’s all happening on the same box (IIUC). The pertinent line in the docker code (as best as I can make it out) is:

-e “MB_DB_CONNECTION_URI=mysql://:3306/<db_name>?user=&password=&allowPublicKeyRetrieval=true” \

So, I assume I need to jam that into my batch file …

----------------> OVER HERE ?? <-----------------------
-jar metabase.jar load-from-h2

… only I’m not sure what the syntax should look like for a batch file. I modified it and added


but it didn’t work. Then again it was a total guess.

Am I anywhere close? Please help.


@chrisKH Correct, when connecting to MySQL 8, it requires some extra steps, since MySQL 8 has upped the security levels a lot.

It looks correct, but I have a feeling that you’re not removing the other variables, so it doesn’t know which variables you want to use.
It should just be (where the user and password is for your MySQL credentials):

java -DMB_DB_CONNECTION_URI="mysql://localhost:3306/metabase?user=my_user&password=my_pwd&allowPublicKeyRetrieval=true" -jar metabase.jar load-from-h2

And then you just remove load-from-h2 after you’ve successfully run the migration.

Hi again,
Well, I think so anyway. My steps were as follows:

  • install mysql and configure sa privileges (running on WAMP)
  • create a new blank mysql database as destination for the migrate
  • stop the metabase process
  • run my batch file … now it completes without errors woohoo!
  • browse the mysql database in phpmyadmin and yes it is now populated with tables relating to metabase

So far so good,
OK, next question, er, what do I do now? How do I start metabase again and make sure that it’s running off the new mySQL database?
I mean, if I run metabase.jar again, won’t it just continue as it was?
Do the and metabase.db.trace.db files in the original folder no longer play a part?
… trying to understand.
Please help.


Actually, don’t worry! Figured it out! :+1::+1:

… and by “figured it out” I mean, “I re-read your last response this time ACTUALLY PAYING ATTENTION” :grinning:

Thanks a lot for your help,
and patience!