quarkusio/quarkus · error · RuntimeException

should not be extended or implemented

Error message

 should not be extended or implemented

What it means

REST Data Panache resource interfaces are terminal: the framework generates the only implementation, so subclasses or other implementors would conflict with generated code. The processor checks the Jandex index for known direct implementors and throws if any exist.

Source

Thrown at extensions/panache/hibernate-reactive-rest-data-panache/deployment/src/main/java/io/quarkus/hibernate/reactive/rest/data/panache/deployment/HibernateReactivePanacheRestProcessor.java:139

                    new UnremovableBeanBuildItem.BeanClassNameExclusion(repositoryClassName)));

            restDataResourceProducer.produce(new RestDataResourceBuildItem(
                    new ResourceMetadata(resourceClass, resourceInterface, entityType, idType,
                            getEntityFields(index, entityType))));
        }
    }

    private void validateResource(IndexView index, ClassInfo classInfo) {
        if (!Modifier.isInterface(classInfo.flags())) {
            throw new RuntimeException(classInfo.name() + " has to be an interface");
        }

        if (classInfo.interfaceNames().size() > 1) {
            throw new RuntimeException(classInfo.name() + " should only extend REST Data Panache interface");
        }

        if (!index.getKnownDirectImplementors(classInfo.name()).isEmpty()) {
            throw new RuntimeException(classInfo.name() + " should not be extended or implemented");
        }
    }

    private List<Type> getGenericTypes(ClassInfo classInfo) {
        return classInfo.interfaceTypes()
                .stream()
                .findFirst()
                .orElseThrow(() -> new RuntimeException(classInfo.toString() + " does not have generic types"))
                .asParameterizedType()
                .arguments();
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Remove the implements/extends clause from your class or interface
  2. Customize behavior via the backing repository/DAO instead of the resource interface
  3. Write a separate JAX-RS resource for custom endpoints

Example fix

// before
public interface CustomCustomerResource extends CustomerResource {}
// after: delete CustomCustomerResource; customize CustomerRepository instead
Defensive patterns

Strategy: validation

Validate before calling

if (!index.getKnownDirectImplementors(DotName.createSimple("CustomerResource")).isEmpty())
    throw new IllegalStateException("REST Data Panache resource interfaces must not be implemented");

Prevention

When it happens

Trigger: A class or interface in the application index directly extends or implements an interface annotated with a REST Data Panache annotation.

Common situations: Trying to 'customize' a resource by extending the generated interface; creating an abstract base resource by implementing the annotated interface.

Related errors


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