{"record":{"id":"1ed7131252a4fb93","repo":"mybatis/mybatis-3","slug":"cannot-resolve-the-provider-method-because-metho","errorCode":null,"errorMessage":"Cannot resolve the provider method because '{methodName}' not found in SqlProvider '{className}'.","messagePattern":"Cannot resolve the provider method because '(.+?)' not found in SqlProvider '(.+?)'\\.","errorType":"exception","errorClass":"BuilderException","httpStatus":null,"severity":"error","filePath":"src/main/java/org/apache/ibatis/builder/annotation/ProviderMethodResolver.java","lineNumber":59,"sourceCode":"   * <ul>\n   * <li>Method name matches with mapper method</li>\n   * <li>Return type matches the {@link CharSequence}({@link String}, {@link StringBuilder}, etc...)</li>\n   * </ul>\n   * If matched method is zero or multiple, it throws a {@link BuilderException}.\n   *\n   * @param context\n   *          a context for SQL provider\n   *\n   * @return an SQL provider method\n   *\n   * @throws BuilderException\n   *           Throws when cannot resolve a target method\n   */\n  default Method resolveMethod(ProviderContext context) {\n    List<Method> sameNameMethods = Arrays.stream(getClass().getMethods())\n        .filter(m -> m.getName().equals(context.getMapperMethod().getName())).collect(Collectors.toList());\n    if (sameNameMethods.isEmpty()) {\n      throw new BuilderException(\"Cannot resolve the provider method because '\" + context.getMapperMethod().getName()\n          + \"' not found in SqlProvider '\" + getClass().getName() + \"'.\");\n    }\n    List<Method> targetMethods = sameNameMethods.stream()\n        .filter(m -> CharSequence.class.isAssignableFrom(m.getReturnType())).collect(Collectors.toList());\n    if (targetMethods.size() == 1) {\n      return targetMethods.get(0);\n    }\n    if (targetMethods.isEmpty()) {\n      throw new BuilderException(\"Cannot resolve the provider method because '\" + context.getMapperMethod().getName()\n          + \"' does not return the CharSequence or its subclass in SqlProvider '\" + getClass().getName() + \"'.\");\n    }\n    throw new BuilderException(\"Cannot resolve the provider method because '\" + context.getMapperMethod().getName()\n        + \"' is found multiple in SqlProvider '\" + getClass().getName() + \"'.\");\n  }\n\n}\n","sourceCodeStart":41,"sourceCodeEnd":76,"githubUrl":"https://github.com/mybatis/mybatis-3/blob/008069adb1b089579b5dcba87ee591908b263274/src/main/java/org/apache/ibatis/builder/annotation/ProviderMethodResolver.java#L41-L76","documentation":"Error \"Cannot resolve the provider method because '{methodName}' not found in SqlProvider '{className}'.\" thrown in mybatis/mybatis-3.","triggerScenarios":"Thrown at src/main/java/org/apache/ibatis/builder/annotation/ProviderMethodResolver.java:59 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a method with the reported name to the SqlProvider class, or correct the method name in the @SelectProvider/@InsertProvider/etc. annotation.","If relying on the default provider method resolution, name the provider method exactly like the mapper method.","Check for typos and case mismatches between the annotation's method attribute and the provider class method."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"008069adb1b089579b5dcba87ee591908b263274","analyzedAt":"2026-08-14T13:07:10.264Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}