quarkusio/quarkus · error · UnsatisfiedResolutionException

No active bean found

Error message

No active bean found

What it means

InjectableInstance.getActive() resolves the beans matching this instance, filters to those currently active, and requires exactly one match. It throws UnsatisfiedResolutionException('No active bean found') when zero beans are active, and AmbiguousResolutionException when more than one is — a way to get the single active contextual instance safely in Arc's hierarchical/conditional bean model.

Source

Thrown at independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InjectableInstance.java:99

     * @return the bean instance or {@code null}
     */
    default T orNull() {
        return orElse(null);
    }

    /**
     * Returns exactly one instance of an {@linkplain InjectableBean#checkActive() active} bean that matches
     * the required type and qualifiers. If no active bean matches, or if more than one active bean matches,
     * throws an exception.
     *
     * @return the single instance of an active matching bean
     */
    default T getActive() {
        List<T> list = listActive();
        if (list.size() == 1) {
            return list.get(0);
        } else if (list.isEmpty()) {
            throw new UnsatisfiedResolutionException("No active bean found");
        } else {
            throw new AmbiguousResolutionException("More than one active bean found: " + list);
        }
    }

    /**
     * Returns the list of instances of {@linkplain InjectableBean#checkActive() active} beans that match
     * the required type and qualifiers, sorter in priority order (higher priority goes first).
     *
     * @return the list of instances of matching active beans
     */
    default List<T> listActive() {
        return handlesStream().filter(it -> it.getBean().isActive()).map(InstanceHandle::get).toList();
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Check why the bean is inactive: review quarkus.* config, profiles, and conditions that disable the synthetic bean, and enable it if needed.
  2. Call listActive() and handle the empty case explicitly instead of getActive() when inactivity is a legitimate state.
  3. Use getActive().get() alternatives like select() checks or Optional handling to fall back gracefully.
  4. Verify the injection point's type/qualifiers actually match the intended bean.

Example fix

// before
Foo foo = instance.getActive(); // throws when inactive

// after
List<Foo> active = instance.listActive();
Foo foo = active.isEmpty() ? Foo.DEFAULT : active.get(0);
Defensive patterns

Strategy: validation

Validate before calling

List<Foo> active = instance.listActive();
if (active.size() != 1) {
    throw new IllegalStateException("Expected exactly 1 active bean, found " + active.size());
}

Type guard

static <T> Optional<T> activeIfUnique(InjectableInstance<T> i) {
    List<T> l = i.listActive();
    return l.size() == 1 ? Optional.of(l.get(0)) : Optional.empty();
}

Try / catch

try {
    return instance.getActive();
} catch (UnsatisfiedResolutionException | AmbiguousResolutionException e) {
    return fallbackInstance; // or rethrow with context about config/profile
}

Prevention

When it happens

Trigger: Calling getActive() on an InjectableInstance whose selection matches only beans that are currently inactive (e.g. disabled synthetic beans), or nothing at all, so listActive() returns an empty list.

Common situations: Using @InjectMock or conditional/synthetic beans that are deactivated by config; injecting an InjectableInstance for a bean excluded by profile or build property; code that assumes a bean exists but the application disabled it via quarkus config.

Related errors


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