quarkusio/quarkus · error · IllegalStateException
Getter accessors container has not been initialized
Error message
Getter accessors container has not been initialized
What it means
The same verifyInit() check in RestLinksProviderImpl also verifies that the getter accessors container was initialized at build time. When it is null, getInstanceLinks() cannot resolve per-instance link property values, so this IllegalStateException is thrown. It signals the REST links build step did not record the getter accessors.
Source
Thrown at extensions/resteasy-reactive/rest-links/runtime/src/main/java/io/quarkus/resteasy/reactive/links/runtime/RestLinksProviderImpl.java:90
private Object[] getPathParameterValues(LinkInfo linkInfo, Object instance) {
List<Object> values = new ArrayList<>(linkInfo.getPathParameters().size());
for (String name : linkInfo.getPathParameters()) {
GetterAccessor accessor = getterAccessorsContainer.get(linkInfo.getEntityType(), name);
if (accessor != null) {
values.add(accessor.get(instance));
} else {
values.add("{" + name + "}");
}
}
return values.toArray();
}
private void verifyInit() {
if (linksContainer == null) {
throw new IllegalStateException("Links context has not been initialized");
}
if (getterAccessorsContainer == null) {
throw new IllegalStateException("Getter accessors container has not been initialized");
}
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Add the quarkus-rest-links extension (including its deployment artifact) to the build so the recorder populates the accessor container
- Call getInstanceLinks only after Quarkus finished booting
- Use @QuarkusTest in tests to ensure full initialization
- Avoid instantiating RestLinksProviderImpl manually in application code
Example fix
// before
List<InstanceLinks> links = RestLinksProvider.get().getInstanceLinks(entity);
// after
@SpringBootTest-less Quarkus test:
@QuarkusTest
class LinksTest { /* provider initialized by the platform */ } Defensive patterns
Strategy: validation
Validate before calling
if (getClass().getResource("/io/quarkus/resteasy/reactive/links/runtime") == null) {
throw new SkipException("rest-links extension not in build");
} Type guard
boolean hasInstanceLinks(Object entity) {
try { return !RestLinksProvider.get().getInstanceLinks(entity).isEmpty(); }
catch (IllegalStateException e) { return false; }
} Try / catch
try {
instanceLinks = RestLinksProvider.get().getInstanceLinks(entity);
} catch (IllegalStateException e) {
throw new ConfigurationException("rest-links not initialized; add the extension", e);
} Prevention
- Verify quarkus-rest-links deployment artifact is on the build classpath
- Call getInstanceLinks only from runtime request handling or post-startup observers
- Bootstrap tests with @QuarkusTest
- Do not hand-construct the provider
When it happens
Trigger: Calling RestLinksProvider.get().getInstanceLinks(...) when the build-time initialization populated neither container (or the getters container specifically), typically because the extension's recorder did not run.
Common situations: Testing provider-dependent code outside Quarkus bootstrap; misconfigured dependency where runtime jar is present but the deployment processor is absent; accessing the provider too early in a custom harness.
Related errors
- Links context has not been initialized
- No CDI container is available
- Cannot add value once finalized
- Header already encoded
- runtime config has already been set
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/3ac5685f71acc324.
Report an issue: GitHub.