{"record":{"id":"2b9b4a446c786d38","repo":"apache/maven","slug":"failed-to-call-injectable-method","errorCode":null,"errorMessage":"Failed to call injectable method {}","messagePattern":"Failed to call injectable method (.+?)","errorType":"exception","errorClass":"DIException","httpStatus":null,"severity":"error","filePath":"impl/maven-di/src/main/java/org/apache/maven/di/impl/ReflectionUtils.java","lineNumber":262,"sourceCode":"    }\n\n    public static <T> BindingInitializer<T> methodInjector(Key<T> container, Method method) {\n        method.setAccessible(true);\n        Dependency<?>[] dependencies = toDependencies(container.getType(), method);\n        return new BindingInitializer<T>(new HashSet<>(Arrays.asList(dependencies))) {\n            @Override\n            public Consumer<T> compile(Function<Dependency<?>, Supplier<?>> compiler) {\n                return instance -> {\n                    Object[] args = getDependencies().stream()\n                            .map(compiler)\n                            .map(Supplier::get)\n                            .toArray();\n                    try {\n                        method.invoke(instance, args);\n                    } catch (IllegalAccessException e) {\n                        throw new DIException(\"Not allowed to call injectable method \" + method, e);\n                    } catch (InvocationTargetException e) {\n                        throw new DIException(\"Failed to call injectable method \" + method, e.getCause());\n                    }\n                };\n            }\n        };\n    }\n\n    public static Dependency<?>[] toDependencies(@Nullable Type container, Executable executable) {\n        Dependency<?>[] keys = toArgDependencies(container, executable);\n        if (executable instanceof Constructor || Modifier.isStatic(executable.getModifiers())) {\n            return keys;\n        } else {\n            Dependency<?>[] nkeys = new Dependency[keys.length + 1];\n            nkeys[0] = new Dependency<>(Key.ofType(container), false);\n            System.arraycopy(keys, 0, nkeys, 1, keys.length);\n            return nkeys;\n        }\n    }\n","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-di/src/main/java/org/apache/maven/di/impl/ReflectionUtils.java#L244-L280","documentation":"Error \"Failed to call injectable method {}\" thrown in apache/maven.","triggerScenarios":"Thrown at impl/maven-di/src/main/java/org/apache/maven/di/impl/ReflectionUtils.java:262 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}