{"record":{"id":"ed59e424a5691639","repo":"quarkusio/quarkus","slug":"should-only-extend-rest-data-panache-interface-ed59e4","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/mongodb-rest-data-panache/deployment/src/main/java/io/quarkus/mongodb/rest/data/panache/deployment/MongoPanacheRestProcessor.java","lineNumber":142,"sourceCode":"                    new UnremovableBeanBuildItem.BeanClassNameExclusion(repositoryClassName)));\n\n            restDataResourceProducer.produce(new RestDataResourceBuildItem(\n                    new ResourceMetadata(resourceClass, resourceInterface, entityType, idType,\n                            getEntityFields(index.getIndex(), entityType))));\n            if (capabilities.isPresent(Capability.RESTEASY)) {\n                bytecodeTransformersProducer.produce(\n                        getEntityIdAnnotationTransformer(entityType, entityClassHelper.getIdField(entityType).name()));\n            }\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    /**\n     * Annotate Mongo entity ID fields with a RESTEasy links annotation.","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/panache/mongodb-rest-data-panache/deployment/src/main/java/io/quarkus/mongodb/rest/data/panache/deployment/MongoPanacheRestProcessor.java#L124-L160","documentation":"validateResource additionally requires that the resource interface extends exactly one REST Data Panache interface. An interface with more than one direct interface name triggers RuntimeException '<class> should only extend REST Data Panache interface'.","triggerScenarios":"Declaring a REST data resource interface that extends two or more interfaces (e.g. a Panache resource interface plus a custom mixin or another resource interface).","commonSituations":"Trying to compose several resource interfaces to reuse custom endpoints; adding a marker interface to the resource; refactoring that merged two resource types.","solutions":["Reduce the resource to extend exactly one REST Data Panache interface.","Move shared custom endpoint logic into a separate CDI bean/service the generated resource can call, not extra super-interfaces.","Remove the extra marker interface."],"exampleFix":"// before\npublic interface BookResource extends PanacheMongoRepositoryResource<Book, ObjectId>, CustomResource {}\n// after\npublic interface BookResource extends PanacheMongoRepositoryResource<Book, ObjectId> {}\n","handlingStrategy":"validation","validationCode":"if (Arrays.stream(resource.getInterfaces()).count() > 1) throw new IllegalArgumentException(\"Resource must extend exactly one REST Data Panache interface\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Extend exactly one resource interface per resource.","Extract shared logic into services/CDI beans instead of extra super-interfaces.","Avoid marker interfaces on resources."],"tags":["mongodb","rest-data-panache","build-time","interface-inheritance"],"backgroundTag":"rest-data-resource-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"}