scalameta / metals

Scala language server with rich IDE features 🚀

Home Page:https://scalameta.org/metals/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JdbcBatchUpdateException: Unique index or primary key violation PUBLIC.PRIMARY_KEY_3

OndrejSpanel opened this issue · comments

Describe the bug

To Reproduce Steps to reproduce the behavior:

When importing my SBT project (quite complex, custom crossbuilding JVM and JS), I get following errors:

org.h2.jdbc.JdbcBatchUpdateException: Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_3 ON PUBLIC.TOPLEVEL_SYMBOL(JAR, PATH, SYMBOL) VALUES ( /* key:22557 */ 126, '/org/scalatest/enablers/TableAsserting.scala', 'org/scalatest/enablers/ForResult#')"; SQL statement:
insert into toplevel_symbol (symbol, path, jar) values (?, ?, ?) [23505-224]
	at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1282)
	at scala.meta.internal.metals.JarTopLevels.putToplevels(JarTopLevels.scala:177)
	at scala.meta.internal.metals.JarTopLevels.putJarIndexingInfo(JarTopLevels.scala:128)
	at scala.meta.internal.metals.Indexer.addSourceJarSymbols(Indexer.scala:657)

2024.05.15 18:08:40 ERROR error processing file:///C:/Users/Ondra/AppData/Local/Coursier/Cache/v1/https/repo1.maven.org/maven2/org/scalatest/scalatest-core_3/3.2.11/scalatest-core_3-3.2.11-sources.jar
org.h2.jdbc.JdbcBatchUpdateException: Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_3 ON PUBLIC.TOPLEVEL_SYMBOL(JAR, PATH, SYMBOL) VALUES ( /* key:25297 */ 143, '/org/scalatest/enablers/TableAsserting.scala', 'org/scalatest/enablers/ForResult#')"; SQL statement:
insert into toplevel_symbol (symbol, path, jar) values (?, ?, ?) [23505-224]
	at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1282)
	at scala.meta.internal.metals.JarTopLevels.putToplevels(JarTopLevels.scala:177)
	at scala.meta.internal.metals.JarTopLevels.putJarIndexingInfo(JarTopLevels.scala:128)


org.h2.jdbc.JdbcBatchUpdateException: Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_3 ON PUBLIC.TOPLEVEL_SYMBOL(JAR, PATH, SYMBOL) VALUES ( /* key:25297 */ 143, '/org/scalatest/enablers/TableAsserting.scala', 'org/scalatest/enablers/ForResult#')"; SQL statement:
insert into toplevel_symbol (symbol, path, jar) values (?, ?, ?) [23505-224]
	at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1282)
	at scala.meta.internal.metals.JarTopLevels.putToplevels(JarTopLevels.scala:177)
	at scala.meta.internal.metals.JarTopLevels.putJarIndexingInfo(JarTopLevels.scala:128)
	at scala.meta.internal.metals.Indexer.addSourceJarSymbols(Indexer.scala:657)

Expected behavior

No errors

Installation:

  • Operating system: Windows 11 x64
  • VSCode version: Version: 1.89.1 (user setup)
  • VSCode extension version: v1.31.5 (pre-release)
  • Metals version: 1.3.0+74-0500a8cd-SNAPSHOT

Search terms

scalatest
PRIMARY_KEY_3

Thanks for reporting! This shouldn't be too much an issue, but might be worth looking into.

If it is not an issue, then it should not yell ERROR at me. I am starting with Metals and it is hard to be sure what is issue and what is not.

If it is not an issue, then it should not yell ERROR at me. I am starting with Metals and it is hard to be sure what is issue and what is not.

It is an error and should be fixed for sure, just we don't have time to currently look into every error, so doing a bit of triage here.