elihart
02/25/2026, 6:07 PMjava.lang.IllegalStateException: Class com.example.MyViewModel should have only one super class. Found 2
(com.example.BaseViewModel<...>, com.example.MyViewModelApi).
at dagger.spi.internal.shaded.androidx.room.compiler.processing.ksp.KspType.superTypes_delegate$lambda$10(KspType.kt:147)
It is incorrectly classifying an interface as a class for some reason, leading to this issue.
I can't find any existing issues on Dagger or Ksp GitHub about this. Unfortunately, it happens very sporadically and I don't have a reproducer.
Would it be helpful to create an issue for Dagger and/or KSP?elihart
02/25/2026, 6:10 PMjava.lang.IllegalStateException: Class com.example.MyViewModel should have only one super class. Found 2
(com.example.BaseViewModel<...>, com.example.MyViewModelApi).
at dagger.spi.internal.shaded.androidx.room.compiler.processing.ksp.KspType.superTypes_delegate$lambda$10(KspType.kt:147)
at dagger.spi.internal.shaded.androidx.room.compiler.processing.ksp.KspType.superTypes_delegate$lambda$10(KspType.kt:147)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:86)
at dagger.spi.internal.shaded.androidx.room.compiler.processing.ksp.KspType.getSuperTypes(KspType.kt:105)
at dagger.internal.codegen.xprocessing.XTypes.nonObjectSuperclass(XTypes.java:430)
at dagger.internal.codegen.binding.InjectionSiteFactory.getInjectionSites(InjectionSiteFactory.java:67)
at dagger.internal.codegen.binding.BindingFactory.assistedInjectionBinding(BindingFactory.java:156)
at dagger.internal.codegen.validation.InjectBindingRegistryImpl.tryRegisterConstructor(InjectBindingRegistryImpl.java:277)
at dagger.internal.codegen.validation.InjectBindingRegistryImpl.lambda$getOrFindInjectionBinding$0(InjectBindingRegistryImpl.java:378)
at dagger.internal.codegen.validation.InjectBindingRegistryImpl.getOrFindInjectionBinding(InjectBindingRegistryImpl.java:376)
at dagger.internal.codegen.binding.LegacyBindingGraphFactory$Resolver.lookUpBindings(LegacyBindingGraphFactory.java:417)
at dagger.internal.codegen.binding.LegacyBindingGraphFactory$Resolver.resolve(LegacyBindingGraphFactory.java:734)
at dagger.internal.codegen.binding.LegacyBindingGraphFactory$Resolver.resolveDependencies(LegacyBindingGraphFactory.java:749)
at dagger.internal.codegen.binding.LegacyBindingGraphFactory$Resolver.resolve(LegacyBindingGraphFactory.java:736)
at dagger.internal.codegen.binding.LegacyBindingGraphFactory$Resolver.resolveDependencies(LegacyBindingGraphFactory.java:749)
at dagger.internal.codegen.binding.LegacyBindingGraphFactory$Resolver.resolve(LegacyBindingGraphFactory.java:736)
at dagger.internal.codegen.binding.LegacyBindingGraphFactory$Resolver.resolveDependencies(LegacyBindingGraphFactory.java:749)
at dagger.internal.codegen.binding.LegacyBindingGraphFactory$Resolver.resolve(LegacyBindingGraphFactory.java:736)
at dagger.internal.codegen.binding.LegacyBindingGraphFactory$Resolver.resolveDependencies(LegacyBindingGraphFactory.java:749)
at dagger.internal.codegen.binding.LegacyBindingGraphFactory$Resolver.resolve(LegacyBindingGraphFactory.java:736)
at dagger.internal.codegen.binding.LegacyBindingGraphFactory$Resolver.resolveDependencies(LegacyBindingGraphFactory.java:749)
at dagger.internal.codegen.binding.LegacyBindingGraphFactory$Resolver.resolve(LegacyBindingGraphFactory.java:736)
at dagger.internal.codegen.binding.LegacyBindingGraphFactory$Resolver.resolveDependencies(LegacyBindingGraphFactory.java:749)
at dagger.internal.codegen.binding.LegacyBindingGraphFactory$Resolver.resolve(LegacyBindingGraphFactory.java:736)
at dagger.internal.codegen.binding.LegacyBindingGraphFactory.lambda$createLegacyBindingGraph$1(LegacyBindingGraphFactory.java:137)
at dagger.internal.codegen.binding.LegacyBindingGraphFactory.createLegacyBindingGraph(LegacyBindingGraphFactory.java:132)
at dagger.internal.codegen.binding.LegacyBindingGraphFactory.create(LegacyBindingGraphFactory.java:120)
at dagger.internal.codegen.binding.BindingGraphFactory.create(BindingGraphFactory.java:111)
at dagger.internal.codegen.processingstep.ComponentProcessingStep.processRootComponent(ComponentProcessingStep.java:112)
at dagger.internal.codegen.processingstep.ComponentProcessingStep.process(ComponentProcessingStep.java:83)
at dagger.internal.codegen.processingstep.ComponentProcessingStep.process(ComponentProcessingStep.java:48)
at dagger.internal.codegen.processingstep.TypeCheckingProcessingStep.lambda$process$0(TypeCheckingProcessingStep.java:96)
at com.google.common.collect.RegularImmutableMap.forEach(RegularImmutableMap.java:293)
at dagger.internal.codegen.processingstep.TypeCheckingProcessingStep.process(TypeCheckingProcessingStep.java:74)
at dagger.internal.codegen.processingstep.TypeCheckingProcessingStep.process(TypeCheckingProcessingStep.java:49)
at dagger.spi.internal.shaded.androidx.room.compiler.processing.XProcessingStep.process(XProcessingStep.kt:57)
at dagger.spi.internal.shaded.androidx.room.compiler.processing.CommonProcessorDelegate.processRound(XBasicAnnotationProcessor.kt:134)
at dagger.spi.internal.shaded.androidx.room.compiler.processing.ksp.KspBasicAnnotationProcessor.process(KspBasicAnnotationProcessor.kt:62)
at com.google.devtools.ksp.impl.KotlinSymbolProcessing$execute$1$1.invoke(KotlinSymbolProcessing.kt:566)
at com.google.devtools.ksp.impl.KotlinSymbolProcessing$execute$1$1.invoke(KotlinSymbolProcessing.kt:564)
at ksp.com.google.devtools.ksp.common.IncrementalContextBase.closeFilesOnException(IncrementalContextBase.kt:403)
at com.google.devtools.ksp.impl.KotlinSymbolProcessing.execute(KotlinSymbolProcessing.kt:564)
at com.google.devtools.ksp.impl.KSPLoader$Companion.loadAndRunKSP(KSPLoader.kt:37)
The class in question:
// Module A
class MyViewModel constructor(...)
: BaseViewModel<...>(...), // CLASS from module B
MyViewModelApi { // INTERFACE from module C
The xprocessing superTypes property partitions super types using classKind == ClassKind.CLASS. The interface from module C is intermittently classified as ClassKind.CLASS
instead of ClassKind.INTERFACE, causing the "should have only one super class" error.
I asked claude code to try to analyze it, and it came up with this theory
KSP2's Analysis API occasionally returns incorrect KaClassKind.CLASS for KaClassSymbol resolved from compiled binary dependencies when the Analysis API's internal cache (VFS
cache, FIR resolution state) is staleBrad Corso
02/25/2026, 7:00 PMelihart
02/25/2026, 7:41 PM