{"record":{"id":"48404e2caafe197e","repo":"quarkusio/quarkus","slug":"should-only-extend-rest-data-panache-interface","errorCode":null,"errorMessage":" should only extend REST Data Panache interface","messagePattern":" should only extend REST Data Panache interface","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/panache/hibernate-reactive-rest-data-panache/deployment/src/main/java/io/quarkus/hibernate/reactive/rest/data/panache/deployment/HibernateReactivePanacheRestProcessor.java","lineNumber":135,"sourceCode":"            String resourceClass = resourceImplementor.implement(\n                    classOutput, dataAccessImplementor, resourceInterface, entityType, listenersForEntityType);\n            // Make sure that repository bean is not removed and will be injected to the generated resource\n            unremovableBeansProducer.produce(new UnremovableBeanBuildItem(\n                    new UnremovableBeanBuildItem.BeanClassNameExclusion(repositoryClassName)));\n\n            restDataResourceProducer.produce(new RestDataResourceBuildItem(\n                    new ResourceMetadata(resourceClass, resourceInterface, entityType, idType,\n                            getEntityFields(index, entityType))));\n        }\n    }\n\n    private void validateResource(IndexView index, ClassInfo classInfo) {\n        if (!Modifier.isInterface(classInfo.flags())) {\n            throw new RuntimeException(classInfo.name() + \" has to be an interface\");\n        }\n\n        if (classInfo.interfaceNames().size() > 1) {\n            throw new RuntimeException(classInfo.name() + \" should only extend REST Data Panache interface\");\n        }\n\n        if (!index.getKnownDirectImplementors(classInfo.name()).isEmpty()) {\n            throw new RuntimeException(classInfo.name() + \" should not be extended or implemented\");\n        }\n    }\n\n    private List<Type> getGenericTypes(ClassInfo classInfo) {\n        return classInfo.interfaceTypes()\n                .stream()\n                .findFirst()\n                .orElseThrow(() -> new RuntimeException(classInfo.toString() + \" does not have generic types\"))\n                .asParameterizedType()\n                .arguments();\n    }\n}\n","sourceCodeStart":117,"sourceCodeEnd":152,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/panache/hibernate-reactive-rest-data-panache/deployment/src/main/java/io/quarkus/hibernate/reactive/rest/data/panache/deployment/HibernateReactivePanacheRestProcessor.java#L117-L152","documentation":"A REST Data Panache resource interface may only extend a single REST Data Panache interface (e.g. PanacheMongoRepositoryResource); extending anything else would make the generated method set ambiguous. The processor enforces this by counting interfaceNames.","triggerScenarios":"An interface annotated with a REST Data Panache annotation extends more than one interface (e.g. both a Panache resource interface and another unrelated interface).","commonSituations":"Adding a custom interface to share extra method contracts with resource interfaces; refactoring that merged resource interfaces with application interfaces.","solutions":["Keep the annotated resource interface extending exactly one REST Data Panache interface","Move any extra interface inheritance to a repository or service class instead","Add custom endpoints via separate CDI beans/JAX-RS resources rather than extra interfaces"],"exampleFix":"// before\n@PanacheRepositoryResource\npublic interface CustomerResource extends PanacheMongoRepositoryResource<CustomerRepository, Customer, Long>, Serializable {}\n// after\n@PanacheRepositoryResource\npublic interface CustomerResource extends PanacheMongoRepositoryResource<CustomerRepository, Customer, Long> {}","handlingStrategy":"validation","validationCode":"if (Arrays.stream(CustomerResource.class.getInterfaces()).count() != 1)\n    throw new IllegalStateException(\"Resource interface must extend exactly one REST Data Panache interface\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Extend only the single REST Data Panache interface","Put extra contracts on the repository, not the resource interface","Avoid Serializable or marker interfaces on resource interfaces"],"tags":["quarkus","rest-data","panache","interface"],"backgroundTag":"resource-extends-multiple-interfaces","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"}