baomidou/mybatis-plus · error · BindingException
Unknown execution method for: %s
Error message
Unknown execution method for: %s
What it means
MybatisMapperMethod.execute switches on the statement's SqlCommandType (INSERT/UPDATE/DELETE/SELECT/FLUSH); this default branch means the mapped statement has a command type outside the known set. In practice this appears with exotic or custom SqlCommandType values, or a corrupted/incompatible statement registration.
Source
Thrown at mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/override/MybatisMapperMethod.java:121
result = executeForCursor(sqlSession, args);
} else {
if (IPage.class.isAssignableFrom(method.getReturnType())) {
result = executeForIPage(sqlSession, args);
} else {
Object param = this.convertArgsToSqlCommandParam(args);
result = sqlSession.selectOne(command.getName(), param);
if (method.returnsOptional()
&& (result == null || !method.getReturnType().equals(result.getClass()))) {
result = Optional.ofNullable(result);
}
}
}
break;
case FLUSH:
result = sqlSession.flushStatements();
break;
default:
throw new BindingException("Unknown execution method for: " + command.getName());
}
if (result == null && method.getReturnType().isPrimitive() && !method.returnsVoid()) {
throw new BindingException("Mapper method '" + command.getName()
+ " attempted to return null from a method with a primitive return type (" + method.getReturnType() + ").");
}
return result;
}
@SuppressWarnings("all")
private <E> Object executeForIPage(SqlSession sqlSession, Object[] args) {
IPage<E> result = null;
for (Object arg : args) {
if (arg instanceof IPage) {
result = (IPage<E>) arg;
break;
}
}
Assert.notNull(result, "can't found IPage for args!");View on GitHub (pinned to bf67d90747)
Solutions
- Align mybatis and mybatis-plus versions (dependency tree check) so SqlCommandType constants match
- Find the statement named in the message ('Unknown execution method for: <id>') and inspect what registered it with an unexpected type
- Remove plugins/interceptors that mutate MappedStatement command types
Example fix
# before mybatis-plus: 3.5.x + mybatis: 3.4.x (mismatched) # after keep the mybatis version transitively provided by the matching mybatis-plus artifact
Defensive patterns
Strategy: validation
Validate before calling
// Startup smoke test: call every mapper method once against a test container applicationContext.getBeansOfType(MapperFactoryBean.class) ... // or simpler: run mapper integration tests so unknown command types surface before prod
Try / catch
catch BindingException during mapper smoke-tests at deploy time; treat as a deployment-blocking version mismatch, not a runtime-recoverable error.
Prevention
- Never mix standalone mybatis versions with the version mybatis-plus pulls transitively
- Run mvn dependency:tree and verify a single mybatis artifact version
- Smoke-test mapper invocations in CI against a real database container
When it happens
Trigger: A mapped statement registered with a custom/unknown SqlCommandType enum constant (e.g. from a fork or future version), or statement metadata manipulated by a plugin so command.getType() is null/unrecognized; calling a mapper method bound to such a statement.
Common situations: Mixing incompatible mybatis/mybatis-plus versions so enum constants differ; custom starter registering statements with hand-built SqlCommandType; reflective hacks on MappedStatement.
Related errors
- Error getting mapper instance. Cause: %s
- Unable to retrieve the mapperInterface and sqlSession proper
- Mapper method '%s' has an unsupported return type: %s
- %s already contains value for %s
- %s does not contain value for %s
AI-assisted analysis of baomidou/mybatis-plus@bf67d90747 (2026-08-14).
Data as JSON: /api/errors/fe79e4f215693826.
Report an issue: GitHub.