mybatis/mybatis-3 · error · BuilderException

Cannot resolve the provider method because '{methodName}' is

Error message

Cannot resolve the provider method because '{methodName}' is found multiple in SqlProvider '{className}'.

What it means

Error "Cannot resolve the provider method because '{methodName}' is found multiple in SqlProvider '{className}'." thrown in mybatis/mybatis-3.

Source

Thrown at src/main/java/org/apache/ibatis/builder/annotation/ProviderMethodResolver.java:71

   *           Throws when cannot resolve a target method
   */
  default Method resolveMethod(ProviderContext context) {
    List<Method> sameNameMethods = Arrays.stream(getClass().getMethods())
        .filter(m -> m.getName().equals(context.getMapperMethod().getName())).collect(Collectors.toList());
    if (sameNameMethods.isEmpty()) {
      throw new BuilderException("Cannot resolve the provider method because '" + context.getMapperMethod().getName()
          + "' not found in SqlProvider '" + getClass().getName() + "'.");
    }
    List<Method> targetMethods = sameNameMethods.stream()
        .filter(m -> CharSequence.class.isAssignableFrom(m.getReturnType())).collect(Collectors.toList());
    if (targetMethods.size() == 1) {
      return targetMethods.get(0);
    }
    if (targetMethods.isEmpty()) {
      throw new BuilderException("Cannot resolve the provider method because '" + context.getMapperMethod().getName()
          + "' does not return the CharSequence or its subclass in SqlProvider '" + getClass().getName() + "'.");
    }
    throw new BuilderException("Cannot resolve the provider method because '" + context.getMapperMethod().getName()
        + "' is found multiple in SqlProvider '" + getClass().getName() + "'.");
  }

}

View on GitHub (pinned to 008069adb1)

Solutions

  1. Remove or rename the duplicate provider methods so only one method with that name exists in the SqlProvider class.
  2. SqlProvider methods cannot be overloaded; merge the overloads into a single method that handles all parameter cases.

When it happens

Trigger: Thrown at src/main/java/org/apache/ibatis/builder/annotation/ProviderMethodResolver.java:71 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of mybatis/mybatis-3@008069adb1 (2026-08-14). Data as JSON: /api/errors/6338564a60e5e5c9. Report an issue: GitHub.