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

  1. Add the quarkus-rest-links extension (including its deployment artifact) to the build so the recorder populates the accessor container
  2. Call getInstanceLinks only after Quarkus finished booting
  3. Use @QuarkusTest in tests to ensure full initialization
  4. 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

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


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