quarkusio/quarkus · error · IllegalStateException

Entity ${entity} was not part of the Quarkus index

Error message

Entity ${entity} was not part of the Quarkus index

What it means

During Quarkus build, the Spring Data JPA extension scans the application index (Jandex) to resolve repository entity classes. When saving/inspecting an entity (isPersistable), the entity's DotName cannot be found in the index, meaning the class was never indexed. Quarkus throws because it cannot generate the stock save method without the entity metadata.

Source

Thrown at extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/StockMethodsAdder.java:244

                    ParamVar methodParam = bmc.parameter("entity");
                    bmc.body(bbc -> {
                        Expr castedParam = bbc.cast(methodParam, ClassDesc.of(entityTypeStr));
                        Expr result = bbc.invokeVirtual(saveDesc, bmc.this_(), castedParam);
                        bbc.return_(result);
                    });
                });
                existingMethods.add(bridgeSaveKey);
            }

            allMethodsToBeImplementedToResult.put(saveKey, true);
            allMethodsToBeImplementedToResult.put(bridgeSaveKey, true);
        }
    }

    private boolean isPersistable(DotName entityDotName) {
        ClassInfo classInfo = index.getClassByName(entityDotName);
        if (classInfo == null) {
            throw new IllegalStateException("Entity " + entityDotName + " was not part of the Quarkus index");
        }

        if (classInfo.interfaceNames().contains(DotNames.SPRING_DATA_PERSISTABLE)) {
            return true;
        }

        DotName superDotName = classInfo.superName();
        if (superDotName.equals(DotNames.OBJECT)) {
            return false;
        }

        return isPersistable(superDotName);
    }

    private void generatePersistAndReturn(Expr entity, BlockCreator bc, Expr opsExpr) {
        bc.invokeVirtual(
                MethodDesc.of(AbstractManagedJpaOperations.class, "persist", void.class, Object.class),
                opsExpr,

View on GitHub (pinned to e1c734241f)

Solutions

  1. Add quarkus.index-dependency.<name>.group-id / .artifact-id (and classifier if needed) in application.properties so the JAR containing the entity gets indexed
  2. Rebuild the library JAR with the Jandex Maven/Gradle plugin so it ships META-INF/jandex.idx
  3. Verify the repository's entity generic parameter matches a real @Entity class on the compile classpath
  4. Move the entity into the application module (which is always indexed)

Example fix

// before (application.properties)
# no indexing of shared-entities.jar

// after
quarkus.index-dependency.entities.group-id=com.example
quarkus.index-dependency.entities.artifact-id=shared-entities
Defensive patterns

Strategy: validation

Validate before calling

// Before building, verify entity module is indexed in application.properties:
// quarkus.index-dependency.entities.group-id=com.example
// quarkus.index-dependency.entities.artifact-id=shared-entities
// Or check the JAR:
// unzip -l shared-entities.jar | grep jandex.idx

Prevention

When it happens

Trigger: A Spring @Repository interface targets an entity class that is not part of the Jandex index: the entity is in a dependency JAR that isn't indexed (no Jandex META-INF/jandex.idx and no quarkus.index-dependency configured), or the entity is generated at runtime, or the entity class name is referenced via a custom base repository generic that points outside the app modules.

Common situations: Entity classes live in a shared library JAR without Jandex indexing; multi-module Maven/Gradle projects where the entity module isn't a Quarkus extension dependency; entities created by annotation processors after indexing.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/469c63f7c0193e55. Report an issue: GitHub.