{"record":{"id":"79bf2ee11828c3a8","repo":"mybatis/mybatis-3","slug":"error-creating-sqlsource-for-sqlprovider-method","errorCode":null,"errorMessage":"Error creating SqlSource for SqlProvider. Method '{methodName}' is found multiple in SqlProvider '{providerTypeName}'. Sql provider method can not overload.","messagePattern":"Error creating SqlSource for SqlProvider\\. Method '(.+?)' is found multiple in SqlProvider '(.+?)'\\. Sql provider method can not overload\\.","errorType":"exception","errorClass":"BuilderException","httpStatus":null,"severity":"error","filePath":"src/main/java/org/apache/ibatis/builder/annotation/ProviderSqlSource.java","lineNumber":123,"sourceCode":"      this.mapperMethod = mapperMethod;\n      Lang lang = mapperMethod == null ? null : mapperMethod.getAnnotation(Lang.class);\n      this.languageDriver = configuration.getLanguageDriver(lang == null ? null : lang.value());\n      this.providerType = getProviderType(configuration, provider, mapperMethod);\n      candidateProviderMethodName = (String) provider.annotationType().getMethod(\"method\").invoke(provider);\n\n      if (candidateProviderMethodName.length() == 0\n          && ProviderMethodResolver.class.isAssignableFrom(this.providerType)) {\n        candidateProviderMethod = ((ProviderMethodResolver) this.providerType.getDeclaredConstructor().newInstance())\n            .resolveMethod(new ProviderContext(mapperType, mapperMethod, configuration.getDatabaseId()));\n      }\n      if (candidateProviderMethod == null) {\n        candidateProviderMethodName = candidateProviderMethodName.length() == 0 ? \"provideSql\"\n            : candidateProviderMethodName;\n        for (Method m : this.providerType.getMethods()) {\n          if (candidateProviderMethodName.equals(m.getName())\n              && CharSequence.class.isAssignableFrom(m.getReturnType())) {\n            if (candidateProviderMethod != null) {\n              throw new BuilderException(\"Error creating SqlSource for SqlProvider. Method '\"\n                  + candidateProviderMethodName + \"' is found multiple in SqlProvider '\" + this.providerType.getName()\n                  + \"'. Sql provider method can not overload.\");\n            }\n            candidateProviderMethod = m;\n          }\n        }\n      }\n    } catch (BuilderException e) {\n      throw e;\n    } catch (Exception e) {\n      throw new BuilderException(\"Error creating SqlSource for SqlProvider.  Cause: \" + e, e);\n    }\n    if (candidateProviderMethod == null) {\n      throw new BuilderException(\"Error creating SqlSource for SqlProvider. Method '\" + candidateProviderMethodName\n          + \"' not found in SqlProvider '\" + this.providerType.getName() + \"'.\");\n    }\n    this.providerMethod = candidateProviderMethod;\n    this.paramNameResolver = new ParamNameResolver(configuration, this.providerMethod, mapperType);","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/mybatis/mybatis-3/blob/008069adb1b089579b5dcba87ee591908b263274/src/main/java/org/apache/ibatis/builder/annotation/ProviderSqlSource.java#L105-L141","documentation":"Error \"Error creating SqlSource for SqlProvider. Method '{methodName}' is found multiple in SqlProvider '{providerTypeName}'. Sql provider method can not overload.\" thrown in mybatis/mybatis-3.","triggerScenarios":"Thrown at src/main/java/org/apache/ibatis/builder/annotation/ProviderSqlSource.java:123 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the overloaded provider method so only one method with the reported name exists in the SqlProvider class.","Sql provider methods cannot be overloaded; consolidate the overloads into one method and branch on the arguments inside it."],"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"}