apache/maven · error · DIException
Not allowed to set injectable field {}
Error message
Not allowed to set injectable field {} What it means
Error "Not allowed to set injectable field {}" thrown in apache/maven.
Source
Thrown at impl/maven-di/src/main/java/org/apache/maven/di/impl/ReflectionUtils.java:239
.collect(toList());
return BindingInitializer.combine(initializers);
}
public static <T> BindingInitializer<T> fieldInjector(Key<T> container, Field field) {
field.setAccessible(true);
Key<Object> key = keyOf(container.getType(), field.getGenericType(), field);
boolean optional = field.isAnnotationPresent(Nullable.class);
Dependency<Object> dep = new Dependency<>(key, optional);
return new BindingInitializer<T>(Collections.singleton(dep)) {
@Override
public Consumer<T> compile(Function<Dependency<?>, Supplier<?>> compiler) {
Supplier<?> binding = compiler.apply(dep);
return (T instance) -> {
Object arg = binding.get();
try {
field.set(instance, arg);
} catch (IllegalAccessException e) {
throw new DIException("Not allowed to set injectable field " + field, e);
}
};
}
};
}
public static <T> BindingInitializer<T> methodInjector(Key<T> container, Method method) {
method.setAccessible(true);
Dependency<?>[] dependencies = toDependencies(container.getType(), method);
return new BindingInitializer<T>(new HashSet<>(Arrays.asList(dependencies))) {
@Override
public Consumer<T> compile(Function<Dependency<?>, Supplier<?>> compiler) {
return instance -> {
Object[] args = getDependencies().stream()
.map(compiler)
.map(Supplier::get)
.toArray();
try {View on GitHub (pinned to e4093d4e12)
When it happens
Trigger: Thrown at impl/maven-di/src/main/java/org/apache/maven/di/impl/ReflectionUtils.java:239 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21).
Data as JSON: /api/errors/481df3219fd92d26.
Report an issue: GitHub.