question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

after upgrading to 1.2.6: `A fatal error happened in `SameAPI`: different extra api hashes for no traits!`

See original GitHub issue

steps

Have multi-module project Change SBT version to 1.2.6

problem

Change SBT version and compile project. Get exception like:

[error] ## Exception when compiling 5 sources to /Users/path/to/project/module/target/scala-2.12/classes
[error] A fatal error happened in `SameAPI`: different extra api hashes for no traits!
[error]   `package.ClassName`: 0
[error]   `package.ClassName`: -1773067415
[error]              
[error] scala.sys.package$.error(package.scala:26)
[error] sbt.internal.inc.IncrementalNameHashing.sameAPI(IncrementalNameHashing.scala:52)
[error] sbt.internal.inc.IncrementalCommon.sameClass(IncrementalCommon.scala:204)
[error] sbt.internal.inc.IncrementalCommon.$anonfun$changedIncremental$1(IncrementalCommon.scala:186)
[error] scala.collection.TraversableLike.$anonfun$flatMap$1(TraversableLike.scala:240)
[error] scala.collection.Iterator.foreach(Iterator.scala:937)
[error] scala.collection.Iterator.foreach$(Iterator.scala:937)
[error] scala.collection.AbstractIterator.foreach(Iterator.scala:1425)
[error] scala.collection.MapLike$DefaultKeySet.foreach(MapLike.scala:177)
[error] scala.collection.TraversableLike.flatMap(TraversableLike.scala:240)
[error] scala.collection.TraversableLike.flatMap$(TraversableLike.scala:237)
[error] scala.collection.AbstractTraversable.flatMap(Traversable.scala:104)
[error] sbt.internal.inc.IncrementalCommon.changedIncremental(IncrementalCommon.scala:185)
[error] sbt.internal.inc.IncrementalCommon.changedInitial(IncrementalCommon.scala:242)
[error] sbt.internal.inc.Incremental$.compile(Incremental.scala:66)
[error] sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:67)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:311)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:269)
[error] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:159)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:238)
[error] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:69)
[error] sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:1544)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:1518)
[error] scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:40)
[error] sbt.std.Transform$$anon$4.work(System.scala:67)
[error] sbt.Execute.$anonfun$submit$2(Execute.scala:269)
[error] sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] sbt.Execute.work(Execute.scala:278)
[error] sbt.Execute.$anonfun$submit$1(Execute.scala:269)
[error] sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error] sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
[error] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
[error] java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[error] java.base/java.lang.Thread.run(Thread.java:844)

Tried to remove all target directories and then build project, SBT throw up very long stack trace, like:

[error] ## Exception when compiling 6 sources to /Users/path/to/project/module/target/scala-2.12/test-classes
[error] null
[error] scala.tools.nsc.typechecker.Contexts$Context.nextOuter(Contexts.scala:629)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:893)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:896)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:896)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:896)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:896)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:896)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:896)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:896)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:897)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:897)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:896)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:896)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:897)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:897)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:896)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:896)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:896)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:896)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:897)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:896)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:896)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:896)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:896)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:896)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:896)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:896)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:916)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:896)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:913)
[error] scala.tools.nsc.typechecker.Contexts$Context.withOuter$1(Contexts.scala:896)
[error] scala.tools.nsc.typechecker.Contexts$Context.implicitss(Contexts.scala:913)
[error] scala.tools.nsc.typechecker.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1477)
[error] scala.tools.nsc.typechecker.Implicits.inferImplicit(Implicits.scala:95)
[error] scala.tools.nsc.typechecker.Implicits.inferImplicit$(Implicits.scala:82)
[error] scala.tools.nsc.Global$$anon$1.inferImplicit(Global.scala:469)
[error] scala.tools.nsc.typechecker.Implicits.inferImplicitFor(Implicits.scala:40)
[error] scala.tools.nsc.typechecker.Implicits.inferImplicitFor$(Implicits.scala:39)
[error] scala.tools.nsc.Global$$anon$1.inferImplicitFor(Global.scala:469)
[error] scala.tools.nsc.typechecker.Typers$Typer.$anonfun$applyImplicitArgs$2(Typers.scala:243)
[error] scala.tools.nsc.typechecker.Typers$Typer.applyImplicitArgs(Typers.scala:236)
[error] scala.tools.nsc.typechecker.Typers$Typer.$anonfun$adapt$1(Typers.scala:881)
[error] scala.tools.nsc.typechecker.Typers$Typer.adaptToImplicitMethod$1(Typers.scala:471)
[error] scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1219)
[error] scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5631)
[error] scala.reflect.macros.contexts.Typers.$anonfun$typecheck$4(Typers.scala:26)
[error] scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:693)
[error] scala.reflect.macros.contexts.Typers.$anonfun$typecheck$3(Typers.scala:26)
[error] scala.reflect.macros.contexts.Typers.$anonfun$typecheck$2(Typers.scala:26)
[error] scala.reflect.macros.contexts.Typers.doTypecheck$1(Typers.scala:25)
[error] scala.reflect.macros.contexts.Typers.$anonfun$typecheck$7(Typers.scala:38)
[error] scala.reflect.internal.Trees.wrappingIntoTerm(Trees.scala:1736)
[error] scala.reflect.internal.Trees.wrappingIntoTerm$(Trees.scala:1733)
[error] scala.reflect.internal.SymbolTable.wrappingIntoTerm(SymbolTable.scala:18)
[error] scala.reflect.macros.contexts.Typers.typecheck(Typers.scala:38)
[error] scala.reflect.macros.contexts.Typers.typecheck$(Typers.scala:20)
[error] scala.reflect.macros.contexts.Context.typecheck(Context.scala:6)
[error] scala.reflect.macros.contexts.Context.typecheck(Context.scala:6)
[error] io.circe.generic.util.macros.ExportMacros.exportDecoder(ExportMacros.scala:20)
[error] jdk.internal.reflect.GeneratedMethodAccessor38.invoke(Unknown Source)
[error] java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] java.base/java.lang.reflect.Method.invoke(Method.java:564)
[error] scala.reflect.macros.runtime.JavaReflectionRuntimes$JavaReflectionResolvers.$anonfun$resolveJavaReflectionRuntime$4(JavaReflectionRuntimes.scala:34)
[error] scala.tools.nsc.typechecker.Macros.macroExpandWithRuntime(Macros.scala:803)
[error] scala.tools.nsc.typechecker.Macros.macroExpandWithRuntime$(Macros.scala:779)
[error] scala.tools.nsc.Global$$anon$1.macroExpandWithRuntime(Global.scala:469)
[error] scala.tools.nsc.typechecker.Macros$MacroExpander.$anonfun$expand$1(Macros.scala:620)
[error] scala.tools.nsc.Global.withInfoLevel(Global.scala:219)
[error] scala.tools.nsc.typechecker.Macros$MacroExpander.expand(Macros.scala:613)
[error] scala.tools.nsc.typechecker.Macros$MacroExpander.apply(Macros.scala:600)
[error] scala.tools.nsc.typechecker.Macros.standardMacroExpand(Macros.scala:764)
[error] scala.tools.nsc.typechecker.Macros.standardMacroExpand$(Macros.scala:762)
[error] scala.tools.nsc.Global$$anon$1.standardMacroExpand(Global.scala:469)
[error] scala.tools.nsc.typechecker.AnalyzerPlugins$$anon$12.default(AnalyzerPlugins.scala:432)
[error] scala.tools.nsc.typechecker.AnalyzerPlugins$$anon$12.default(AnalyzerPlugins.scala:429)
[error] scala.tools.nsc.typechecker.AnalyzerPlugins.invoke(AnalyzerPlugins.scala:401)
[error] scala.tools.nsc.typechecker.AnalyzerPlugins.pluginsMacroExpand(AnalyzerPlugins.scala:429)
[error] scala.tools.nsc.typechecker.AnalyzerPlugins.pluginsMacroExpand$(AnalyzerPlugins.scala:429)
[error] scala.tools.nsc.Global$$anon$1.pluginsMacroExpand(Global.scala:469)
[error] scala.tools.nsc.typechecker.Macros.macroExpand(Macros.scala:757)
[error] scala.tools.nsc.typechecker.Macros.macroExpand$(Macros.scala:757)
[error] scala.tools.nsc.Global$$anon$1.macroExpand(Global.scala:469)
[error] scala.tools.nsc.typechecker.Typers$Typer.vanillaAdapt$1(Typers.scala:1163)
[error] scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1223)
[error] scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1196)
[error] scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5631)
[error] scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedArg$1(Typers.scala:3280)
[error] scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:471)
[error] scala.tools.nsc.typechecker.PatternTypers$PatternTyper.typedArgWithFormal$1(PatternTypers.scala:108)
[error] scala.tools.nsc.typechecker.PatternTypers$PatternTyper.$anonfun$typedArgsForFormals$4(PatternTypers.scala:122)
[error] scala.tools.nsc.typechecker.PatternTypers$PatternTyper.typedArgsForFormals(PatternTypers.scala:122)
[error] scala.tools.nsc.typechecker.PatternTypers$PatternTyper.typedArgsForFormals$(PatternTypers.scala:103)
[error] scala.tools.nsc.typechecker.Typers$Typer.typedArgsForFormals(Typers.scala:184)
[error] scala.tools.nsc.typechecker.Typers$Typer.handleMonomorphicCall$1(Typers.scala:3619)
[error] scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:3652)
[error] scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4767)
[error] scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4776)
[error] scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5571)
[error] scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5617)
[error] scala.tools.nsc.typechecker.Typers$Typer.$anonfun$adapt$1(Typers.scala:881)
[error] scala.tools.nsc.typechecker.Typers$Typer.adaptToImplicitMethod$1(Typers.scala:471)
[error] scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1219)
[error] scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1216)
[error] scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit1(Implicits.scala:759)
[error] scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit0(Implicits.scala:696)
[error] scala.tools.nsc.typechecker.Implicits$ImplicitSearch.scala$tools$nsc$typechecker$Implicits$ImplicitSearch$$typedImplicit(Implicits.scala:513)
[error] scala.tools.nsc.typechecker.Implicits$ImplicitSearch$ImplicitComputation.rankImplicits(Implicits.scala:1019)
[error] scala.tools.nsc.typechecker.Implicits$ImplicitSearch$ImplicitComputation.findBest(Implicits.scala:1050)
[error] scala.tools.nsc.typechecker.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1107)
[error] scala.tools.nsc.typechecker.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1503)
[error] scala.tools.nsc.typechecker.Implicits.inferImplicit(Implicits.scala:95)
[error] scala.tools.nsc.typechecker.Implicits.inferImplicit$(Implicits.scala:82)
...

After next recompilation, project managed to get built.

expectation

Upgrade of patch versions should be simple, but if there are some internal format incompatibilities, then SBT must inform user to discard previous compilation results.

notes

There are several such places where SBT fails to compile. The exception happens for case classes like:

    final case class ClassName(field: OtherCaseClass)

    object SetupResponse {
      implicit val ClassNameFormat: OFormat[ClassName] = Json.format
    }

sbt version: 1.2.6 jvm version: oracle 10.0.2 IDE: JetBrains IDEA Ultimate 2018.2

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:24 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
smartercommented, Nov 13, 2018

@jvican it seems that there’s more unforeseen issues with the API check you added in zinc. Any idea why ? What about just disabling the assertion ?

0reactions
eed3si9ncommented, Dec 4, 2018

Awesome.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scala sbt 1.2.6 patch notes - Lightbend
[error] java.lang.RuntimeException: A fatal error happened in `SameAPI`: different extra api hashes for no traits! [error] `akka.util.
Read more >
akka/alpakka-kafka - Gitter
I keep getting [error] ## Exception when compiling 33 sources to ... [error] A fatal error happened in `SameAPI`: different extra api hashes...
Read more >
Known issues with Microsoft Graph
This article describes known issues and limitations with Microsoft Graph and provides workarounds when possible.
Read more >
mbedtls/ChangeLog at development · Mbed-TLS ... - GitHub
An open source, portable, easy to use, readable and flexible TLS library, and reference implementation of the PSA Cryptography API. - mbedtls/ChangeLog at ......
Read more >
Nxt Software Change Log - Getting started
This is an experimental release, enabling several new features on testnet only at block height 2500000. All testnet nodes must upgrade to this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found