{"record":{"id":"2a01d04e4459872f","repo":"mockito/mockito","slug":"no-matchers-found-for-additional-matcher-additio","errorCode":null,"errorMessage":"No matchers found for additional matcher ${additionalMatcherName}\n${location}\n","messagePattern":"No matchers found for additional matcher (.+?)\n(.+?)\n","errorType":"exception","errorClass":"InvalidUseOfMatchersException","httpStatus":null,"severity":"error","filePath":"mockito-core/src/main/java/org/mockito/internal/progress/ArgumentMatcherStorageImpl.java","lineNumber":85,"sourceCode":"        reportMatcher(new Not(m));\n    }\n\n    @Override\n    public void validateState() {\n        if (!matcherStack.isEmpty()) {\n            List<LocalizedMatcher> lastMatchers = resetStack();\n            throw misplacedArgumentMatcher(lastMatchers);\n        }\n    }\n\n    @Override\n    public void reset() {\n        matcherStack.clear();\n    }\n\n    private void assertStateFor(String additionalMatcherName, int subMatchersCount) {\n        if (matcherStack.isEmpty()) {\n            throw reportNoSubMatchersFound(additionalMatcherName);\n        }\n        if (matcherStack.size() < subMatchersCount) {\n            List<LocalizedMatcher> lastMatchers = resetStack();\n            throw incorrectUseOfAdditionalMatchers(\n                    additionalMatcherName, subMatchersCount, lastMatchers);\n        }\n    }\n\n    private ArgumentMatcher<?> popMatcher() {\n        return matcherStack.pop().getMatcher();\n    }\n\n    private List<LocalizedMatcher> resetStack() {\n        ArrayList<LocalizedMatcher> lastMatchers = new ArrayList<>(matcherStack);\n        reset();\n        return lastMatchers;\n    }\n}","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/mockito/mockito/blob/5a676bcd9ef9a10db46e1dc34e190eb46faa2687/mockito-core/src/main/java/org/mockito/internal/progress/ArgumentMatcherStorageImpl.java#L67-L103","documentation":"Thrown by ArgumentMatcherStorageImpl.assertStateFor when AdditionalMatchers.and()/or()/not() is reported but the matcher stack is empty — i.e. no sub-matchers were registered before the combinator was applied. The additional matcher requires at least one (and the requested number of) sub-matchers on the stack.","triggerScenarios":"Calling AdditionalMatchers.not() / and() / or() without any matcher arguments registered, e.g. AdditionalMatchers.and() with zero matchers, or calling these outside of when/verify so matchers were never pushed.","commonSituations":"Typos dropping the inner matcher call; using AdditionalMatchers in plain code outside stubbing/verification; refactoring removed the inner any()/eq() calls but left the combinator.","solutions":["Provide the required sub-matchers inside the combinator, e.g. AdditionalMatchers.and(gt(0), lt(10))","Use the combinator only within when(...) or verify(...)","Check that inner matcher calls were not accidentally deleted or commented out"],"exampleFix":"// before\nverify(mock).foo(AdditionalMatchers.and());\n// after\nverify(mock).foo(AdditionalMatchers.and(gt(0), lt(10)));","handlingStrategy":"validation","validationCode":"// Ensure AdditionalMatchers combinators always receive sub-matchers\nif (subMatcherCount == 0) {\n    throw new IllegalArgumentException(\"AdditionalMatchers.and/or/not require sub-matchers\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass at least one matcher to and()/or()/not()","Use these combinators only inside when()/verify()","Review refactors that may have removed inner matcher calls"],"tags":["mockito","additionalmatchers","argument-matchers","java"],"backgroundTag":"invalid-use-of-argument-matchers","analyzedSha":"5a676bcd9ef9a10db46e1dc34e190eb46faa2687","analyzedAt":"2026-09-05T19:32:58.607Z","contentChangedAt":"2026-09-05T19:32:58.607Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}