{"record":{"id":"29d0ee5301e93a7f","repo":"quarkusio/quarkus","slug":"class-s-was-not-found","errorCode":null,"errorMessage":"Class '%s' was not found","messagePattern":"Class '(.+?)' was not found","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/resteasy-reactive/rest-links/deployment/src/main/java/io/quarkus/resteasy/reactive/links/deployment/LinksProcessor.java","lineNumber":230,"sourceCode":"            if (annotationInstance.name().toString().endsWith(annotation)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    /**\n     * Validates if the given classname contains a field `id` or annotated with `@Id`\n     *\n     * @throws IllegalStateException if the classname does not contain any sort of field identifier\n     */\n    private void validateClassHasFieldId(IndexView index, String entityType) {\n        // create a new independent class name that we can override\n        DotName className = DotName.createSimple(entityType);\n        ClassInfo classInfo = index.getClassByName(className);\n\n        if (classInfo == null) {\n            throw new RuntimeException(String.format(\"Class '%s' was not found\", className));\n        }\n        validateRec(index, entityType, classInfo);\n    }\n\n    /**\n     * Validates if the given classname contains a field `id` or annotated with `@Id`\n     *\n     * @throws IllegalStateException if the classname does not contain any sort of field identifier\n     */\n    private void validateRec(IndexView index, String entityType, ClassInfo classInfo) {\n        List<FieldInfo> fieldsNamedId = classInfo.fields().stream()\n                .filter(f -> f.name().equals(\"id\"))\n                .toList();\n\n        List<AnnotationInstance> fieldsAnnotatedWithId = classInfo.fields().stream()\n                .flatMap(f -> f.annotations().stream())\n                .filter(a -> a.name().toString().endsWith(\"persistence.Id\"))\n                .toList();","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/resteasy-reactive/rest-links/deployment/src/main/java/io/quarkus/resteasy/reactive/links/deployment/LinksProcessor.java#L212-L248","documentation":"During the rest-links build step, validateClassHasFieldId looks up the entity type of a resource method in the Jandex index to verify it has an id. If the entity class is not in the application index (not part of the application's classes/beans-archive), a RuntimeException 'Class %s was not found' is thrown and the build fails.","triggerScenarios":"A REST resource method whose entity/path parameter type is not indexed — e.g. the class comes from a jar without a Jandex index (missing jandex-maven-plugin or META-INF/jandex.idx), or the type name is wrong/unresolvable.","commonSituations":"Using a DTO/entity from an external library jar without a Jandex index; generated classes not added to the index; multi-module builds where the entity module was not indexed.","solutions":["Add a Jandex index to the library containing the class (jandex-maven-plugin / io.quarkus:quarkus-extension-processor, or quarkus.index-dependencies.* config).","Ensure the class is in your application source so it is indexed automatically.","Check the configured entity type name is correct and the jar is on the application classpath."],"exampleFix":"// before: external jar without index\n// after (library pom.xml)\n<plugin>\n  <groupId>io.smallrye</groupId>\n  <artifactId>jandex-maven-plugin</artifactId>\n  <executions><execution><id>make-index</id><goals><goal>jandex</goal></goals></execution></executions>\n</plugin>","handlingStrategy":"validation","validationCode":"// ensure entity jar is indexed\n// mvn jandex:jandex on the library, or verify META-INF/jandex.idx exists in the jar\nunzip -l shared-entities.jar | grep jandex.idx","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always jandex external jars referenced by Quarkus build steps","Keep entities in the application module where possible","Check quarkus.index-dependencies config for library jars"],"tags":["build-time","jandex","rest-links"],"backgroundTag":"class-not-found","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}