alibaba/nacos · error · NacosRuntimeException
103
103
Error message
[MapperManager] Failed to find the table ,tableName: + tableName
What it means
Thrown by MapperManager.findMapper as NacosRuntimeException with code FIND_TABLE_ERROR_CODE (103) when the dataSource is registered but the requested tableName is not present in that datasource's table->Mapper map. The dialect plugin loaded but has no Mapper for this specific table.
Source
Thrown at plugin/datasource/src/main/java/com/alibaba/nacos/plugin/datasource/MapperManager.java:119
* @return mapper.
*/
public <R extends Mapper> R findMapper(String dataSource, String tableName) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("[MapperManager] findMapper dataSource: {}, tableName: {}", dataSource,
tableName);
}
if (StringUtils.isBlank(dataSource) || StringUtils.isBlank(tableName)) {
throw new NacosRuntimeException(FIND_DATASOURCE_ERROR_CODE,
"dataSource or tableName is null");
}
Map<String, Mapper> tableMapper = MAPPER_SPI_MAP.get(dataSource);
if (Objects.isNull(tableMapper)) {
throw new NacosRuntimeException(FIND_DATASOURCE_ERROR_CODE,
"[MapperManager] Failed to find the datasource,dataSource:" + dataSource);
}
Mapper mapper = tableMapper.get(tableName);
if (Objects.isNull(mapper)) {
throw new NacosRuntimeException(FIND_TABLE_ERROR_CODE,
"[MapperManager] Failed to find the table ,tableName:" + tableName);
}
if (dataSourceLogEnable) {
return MapperProxy.createSingleProxy(mapper);
}
return (R) mapper;
}
/**
* Get all mappers.
*
* @return unmodifiable map of all mappers
*/
public Map<String, Map<String, Mapper>> getAllMappers() {
return Collections.unmodifiableMap(MAPPER_SPI_MAP);
}
}
View on GitHub (pinned to 9b989acdf1)
Solutions
- Confirm the tableName is one the datasource plugin models; consult the plugin's mapper list.
- Upgrade the datasource plugin to a version that includes a Mapper for the requested table.
- If the table is custom, provide a Mapper implementation and register it via SPI.
Example fix
// before
mapperManager.findMapper("mysql", "my_custom_table"); // -> 103 table
// after: implement + register a Mapper for the custom table
public class MyCustomTableMapperByMysql extends AbstractMapper {
@Override public String getTableName() { return "my_custom_table"; }
// ... column/methods
}
// add to META-INF/services com.alibaba.nacos.plugin.datasource.Mapper Defensive patterns
Strategy: try-catch
Validate before calling
// verify a mapper exists for the table in this datasource Map<String, Mapper> tables = mapperManager.getAllMappers().get(dataSource); boolean ok = tables != null && tables.containsKey(tableName);
Type guard
static boolean tableHasMapper(MapperManager mm, String ds, String table) {
Map<String, Mapper> t = mm.getAllMappers().get(ds);
return t != null && t.containsKey(table);
} Try / catch
try {
return mapperManager.findMapper(ds, table);
} catch (NacosRuntimeException e) {
if (e.getCode() == FIND_TABLE_ERROR_CODE) {
// upgrade dialect plugin or add a custom Mapper
}
throw e;
} Prevention
- Use table names modeled by the installed dialect plugin.
- Upgrade the plugin when new tables are introduced.
- For custom tables, implement and SPI-register a Mapper.
When it happens
Trigger: Calling findMapper with a valid dataSource and a tableName for which no Mapper implementation exists in that datasource's registered set (e.g. a custom table or a table unsupported by the dialect plugin).
Common situations: Querying a table not modeled by the datasource plugin; version mismatch where a newer table is requested against an older plugin; custom tables added without a corresponding Mapper SPI.
Related errors
- 102
- No DatabaseDialect implementation found for selected type:
- RESOURCE_NOT_FOUND
- RESOURCE_NOT_FOUND
- RESOURCE_NOT_FOUND
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/d41c88d8246e97ad.
Report an issue: GitHub.