Row (1) not found in primary index

I keep seeing this error show up in the shell

Caused by: org.h2.jdbc.JdbcSQLException: Row {1} not found in primary index “PUBLIC.QRTZ_SCHEDULER_STATE_DATA: 387406” [90143-197]

    at org.h2.message.DbException.getJdbcSQLException(DbException.java:357)
    at org.h2.message.DbException.get(DbException.java:179)
    at org.h2.message.DbException.get(DbException.java:155)
    at org.h2.mvstore.db.MVPrimaryIndex.getRow(MVPrimaryIndex.java:202)
    at org.h2.mvstore.db.MVTable.getRow(MVTable.java:492)
    at org.h2.mvstore.db.MVSecondaryIndex$MVStoreCursor.get(MVSecondaryIndex.java:493)
    at org.h2.index.IndexCursor.get(IndexCursor.java:299)
    at org.h2.table.TableFilter.getValue(TableFilter.java:1051)
    at org.h2.expression.ExpressionColumn.getValue(ExpressionColumn.java:189)
    at org.h2.command.dml.Select$LazyResultQueryFlat.fetchNextRow(Select.java:1460)
    at org.h2.result.LazyResult.hasNext(LazyResult.java:79)
    at org.h2.result.LazyResult.next(LazyResult.java:59)
    at org.h2.command.dml.Select.queryFlat(Select.java:527)
    at org.h2.command.dml.Select.queryWithoutCache(Select.java:633)
    at org.h2.command.dml.Query.queryWithoutCacheLazyCheck(Query.java:114)
    at org.h2.command.dml.Query.query(Query.java:371)
    at org.h2.command.dml.Query.query(Query.java:333)
    at org.h2.command.CommandContainer.query(CommandContainer.java:114)
    at org.h2.command.Command.executeQuery(Command.java:202)
    ... 8 more

What is this referring to and how do I correct it?

Hi @sourceminer
Are you using H2 for application data? It looks like there’s a corruption somewhere, but the table QRTZ_SCHEDULER_STATE_DATA is unknown to me, I know of QRTZ_SCHEDULER_STATE. Which version are you using?
I would highly recommend that you migrate away:
https://www.metabase.com/docs/latest/operations-guide/migrating-from-h2.html

Is there a document on how to do this on a windows machine?
I found this but not sure if its still relevant

I also went ahead and ran this:
java -DMB_DB_TYPE=mysql -DMB_DB_DBNAME=metabase -DMB_DB_PORT=3306 -DMB_DB_USER=root -DMB_DB_PASS=**** -DMB_DB_HOST=localhost -jar metabase.jar load-from-h2 C:\Metabase\metabase.db

However got this error:

Transfering 588 instances of FieldValues…e[34m.e[0mBatchUpdateException:
Message: (conn=3505) Incorrect string value: ‘\xE4\xB8\x93\xE4\xB8\x9A…’ for column ‘values’ at row 1
SQLState: HY000
Error Code: 1366
java.sql.BatchUpdateException: (conn=3505) Incorrect string value: ‘\xE4\xB8\x93\xE4\xB8\x9A…’ for column ‘values’ at row 1
at org.mariadb.jdbc.MariaDbStatement.executeBatchExceptionEpilogue(MariaDbStatement.java:309)
at org.mariadb.jdbc.ClientSidePreparedStatement.executeBatch(ClientSidePreparedStatement.java:293)
at clojure.java.jdbc$execute_batch.invokeStatic(jdbc.clj:591)
at clojure.java.jdbc$execute_batch.invoke(jdbc.clj:584)
at clojure.java.jdbc$db_do_execute_prepared_statement$fn__15523.invoke(jdbc.clj:1039)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:842)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:769)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:782)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:769)
at clojure.java.jdbc$db_do_execute_prepared_statement.invokeStatic(jdbc.clj:1038)
at clojure.java.jdbc$db_do_execute_prepared_statement.invoke(jdbc.clj:1024)
at clojure.java.jdbc$db_do_prepared.invokeStatic(jdbc.clj:1062)
at clojure.java.jdbc$db_do_prepared.invoke(jdbc.clj:1042)
at clojure.java.jdbc$insert_cols_BANG_.invokeStatic(jdbc.clj:1576)
at clojure.java.jdbc$insert_cols_BANG_.invoke(jdbc.clj:1567)
at clojure.java.jdbc$insert_multi_BANG_.invokeStatic(jdbc.clj:1633)
at clojure.java.jdbc$insert_multi_BANG_.invoke(jdbc.clj:1601)
at metabase.cmd.load_from_h2$insert_chunk_BANG_.invokeStatic(load_from_h2.clj:146)
at metabase.cmd.load_from_h2$insert_chunk_BANG_.invoke(load_from_h2.clj:141)
at metabase.cmd.load_from_h2$insert_entity_BANG_.invokeStatic(load_from_h2.clj:157)
at metabase.cmd.load_from_h2$insert_entity_BANG_.invoke(load_from_h2.clj:151)
at metabase.cmd.load_from_h2$load_data_BANG_.invokeStatic(load_from_h2.clj:165)
at metabase.cmd.load_from_h2$load_data_BANG_.invoke(load_from_h2.clj:160)
at metabase.cmd.load_from_h2$load_from_h2_BANG_$fn__67570.invoke(load_from_h2.clj:257)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:799)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:769)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:834)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:769)
at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:782)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:769)
at metabase.cmd.load_from_h2$load_from_h2_BANG_.invokeStatic(load_from_h2.clj:245)
at metabase.cmd.load_from_h2$load_from_h2_BANG_.invoke(load_from_h2.clj:234)
at clojure.lang.Var.invoke(Var.java:384)
at metabase.cmd$load_from_h2.invokeStatic(cmd.clj:41)
at metabase.cmd$load_from_h2.invoke(cmd.clj:34)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invokeStatic(core.clj:665)
at clojure.core$apply.invoke(core.clj:660)
at metabase.cmd$run_cmd$fn__66801.invoke(cmd.clj:156)
at metabase.cmd$run_cmd.invokeStatic(cmd.clj:156)
at metabase.cmd$run_cmd.invoke(cmd.clj:152)
at clojure.lang.Var.invoke(Var.java:388)
at metabase.core$run_cmd.invokeStatic(core.clj:133)
at metabase.core$run_cmd.invoke(core.clj:131)
at metabase.core$_main.invokeStatic(core.clj:142)
at metabase.core$_main.doInvoke(core.clj:138)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at metabase.core.main(Unknown Source)
Caused by: java.sql.SQLException: (conn=3505) Incorrect string value: ‘\xE4\xB8\x93\xE4\xB8\x9A…’ for column ‘values’ at row 1
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:262)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:164)
at org.mariadb.jdbc.MariaDbStatement.executeBatchExceptionEpilogue(MariaDbStatement.java:305)
… 48 more
Caused by: java.sql.SQLException: Incorrect string value: ‘\xE4\xB8\x93\xE4\xB8\x9A…’ for column ‘values’ at row 1
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readErrorPacket(AbstractQueryProtocol.java:1599)
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readPacket(AbstractQueryProtocol.java:1461)
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.getResult(AbstractQueryProtocol.java:1424)
at org.mariadb.jdbc.internal.protocol.AsyncMultiRead.call(AsyncMultiRead.java:149)
at org.mariadb.jdbc.internal.protocol.AsyncMultiRead.call(AsyncMultiRead.java:67)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Command failed with exception: (conn=3505) Incorrect string value: ‘\xE4\xB8\x93\xE4\xB8\x9A…’ for column ‘values’ at row 1

@sourceminer You’re getting that error because you’re not using utf8mb4 as charset on MySQL, so you need to convert the database (tables+columns) - have a look at this issue on how to check and convert your database:
https://github.com/metabase/metabase/issues/10691