{"record":{"id":"31801d3337ab5a8b","repo":"quarkusio/quarkus","slug":"your-repository-class-was-not-properly-detected-a","errorCode":null,"errorMessage":"Your repository class  was not properly detected and assigned an entity type","messagePattern":"Your repository class  was not properly detected and assigned an entity type","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/panache/hibernate-orm-panache-common/runtime/src/main/java/io/quarkus/hibernate/orm/panache/common/runtime/AbstractJpaOperations.java","lineNumber":75,"sourceCode":"        for (Entry<String, String> entry : map.entrySet()) {\n            try {\n                Class<?> repoClass = Class.forName(entry.getKey(), false, classLoader);\n                Class<?> entityClass = Class.forName(entry.getValue(), false, classLoader);\n                converted.put(repoClass, entityClass);\n            } catch (ClassNotFoundException e) {\n                throw new RuntimeException(\"Unable to load repository/entity class mapping \"\n                        + entry.getKey() + \" -> \" + entry.getValue(), e);\n            }\n        }\n        repositoryClassToEntityClass = Collections.unmodifiableMap(converted);\n    }\n\n    public static <Entity> Class<? extends Entity> getRepositoryEntityClass(\n            // FIXME: if we move this to JpaOperations we can add a type constraint on the repo class\n            Class<?> repositoryImplementationClass) {\n        Class<?> ret = repositoryClassToEntityClass.get(repositoryImplementationClass);\n        if (ret == null) {\n            throw new RuntimeException(\"Your repository class \" + repositoryImplementationClass\n                    + \" was not properly detected and assigned an entity type\");\n        }\n        return (Class<? extends Entity>) ret;\n    }\n\n    //\n    // Instance\n\n    private Class<SessionType> sessionType;\n\n    protected AbstractJpaOperations(Class<SessionType> sessionType) {\n        this.sessionType = sessionType;\n    }\n\n    protected abstract PanacheQueryType createPanacheQuery(SessionType session, Class<?> entityClass, String query,\n            String originalQuery,\n            Sort sort,\n            Object paramsArrayOrMap);","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/panache/hibernate-orm-panache-common/runtime/src/main/java/io/quarkus/hibernate/orm/panache/common/runtime/AbstractJpaOperations.java#L57-L93","documentation":"Panache repositories are mapped to their entity classes during build-time augmentation. getRepositoryEntityClass looks up this mapping at runtime; if a repository implementation class has no entry, the repository was not processed by the Panache enhancement step and cannot be used.","triggerScenarios":"Invoking a Panache repository method whose implementation class was not registered via setRepositoryClassesToEntityClasses — e.g. a repository instantiated manually, placed in a non-indexed module, or not extending PanacheRepository so the augmentor skipped it.","commonSituations":"Repository in a plain (non-Quarkus) jar without Jandex index; a repository class created at runtime via proxy/reflection; Quarkus app not re-augmented after adding the repository; using a custom base repository class that the augmentor does not recognize.","solutions":["Make the repository extend PanacheRepository (or PanacheRepositoryBase) and be a @ApplicationScoped CDI bean","Ensure the class is in a module indexed by Jandex (add jandex Gradle/Maven plugin or META-INF/jandex.idx for third-party jars)","Rebuild/re-augment the application so Panache records the repository->entity mapping","Check that no @Exclude or build-step filter drops the repository class from processing"],"exampleFix":"// before\nclass PersonRepo { EntityManager em; ... }\n// after\n@ApplicationScoped\npublic class PersonRepo implements PanacheRepository<Person> { }","handlingStrategy":"validation","validationCode":"if (!PanacheRepository.class.isAssignableFrom(repo.getClass())) {\n    throw new IllegalStateException(\"Repository must extend PanacheRepository to be auto-mapped to an entity\");\n}","typeGuard":"boolean isValidPanacheRepository(Class<?> c) {\n    return PanacheRepository.class.isAssignableFrom(c);\n}","tryCatchPattern":"try {\n    repository.findById(id);\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"was not properly detected and assigned an entity type\")) {\n        // repository not enhanced: check Jandex indexing and PanacheRepository inheritance\n    } else throw e;\n}","preventionTips":["Always extend PanacheRepository/PanacheRepositoryBase","Make repositories CDI beans (@ApplicationScoped), don't instantiate them manually","Ensure all business modules have the Jandex plugin applied","Rebuild after adding new repository classes"],"tags":["quarkus","panache","repository","augmentation"],"backgroundTag":"repository-not-enhanced","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}