alibaba/nacos · error · NacosRuntimeException
500
500
Error message
Namespace creation failed
What it means
EmbeddedNamespacePersistServiceImpl.insertTenantInfoAtomic throws NacosRuntimeException(SERVER_ERROR 500) when databaseOperate.update(...) returns false — i.e. the INSERT into tenant_info affected zero rows in embedded (Derby) storage. This is a server-side persistence failure, not a client validation problem: the request was well-formed but the DB rejected/ignored the write.
Source
Thrown at core/src/main/java/com/alibaba/nacos/core/namespace/repository/EmbeddedNamespacePersistServiceImpl.java:93
public void insertTenantInfoAtomic(String kp, String tenantId, String tenantName,
String tenantDesc,
String createResource, final long time) {
TenantInfoMapper tenantInfoMapper = mapperManager
.findMapper(dataSourceService.getDataSourceType(), TableConstant.TENANT_INFO);
final String sql = tenantInfoMapper.insert(Arrays
.asList("kp", "tenant_id", "tenant_name", "tenant_desc", "create_source", "gmt_create",
"gmt_modified"));
final Object[] args =
new Object[] {kp, tenantId, tenantName, tenantDesc, createResource, time, time};
EmbeddedStorageContextHolder.addSqlContext(sql, args);
try {
boolean result =
databaseOperate.update(EmbeddedStorageContextHolder.getCurrentSqlContext());
if (!result) {
throw new NacosRuntimeException(NacosException.SERVER_ERROR,
"Namespace creation failed");
}
} finally {
EmbeddedStorageContextHolder.cleanAllContext();
}
}
@Override
public void removeTenantInfoAtomic(final String kp, final String tenantId) {
TenantInfoMapper tenantInfoMapper = mapperManager
.findMapper(dataSourceService.getDataSourceType(), TableConstant.TENANT_INFO);
EmbeddedStorageContextHolder
.addSqlContext(tenantInfoMapper.delete(Arrays.asList("kp", "tenant_id")), kp, tenantId);
try {
databaseOperate.update(EmbeddedStorageContextHolder.getCurrentSqlContext());
} finally {
EmbeddedStorageContextHolder.cleanAllContext();View on GitHub (pinned to 9b989acdf1)
Solutions
- Ensure only ONE writer process owns the Derby data directory (use MySQL for clustered/multi-node setups).
- Check disk space and write permissions on the nacos data dir (conf derby.log + data/derby).
- Inspect the server log for the underlying SQL/lock error around the failing insert.
- If corrupt, stop the server, back up and repair/remove the derby DB, then restart.
Defensive patterns
Strategy: try-catch
Try / catch
try {
namespaceService.createNamespace(customId, name, desc);
} catch (NacosException e) {
if (e.getErrCode() == 500 && e.getMessage().contains("Namespace creation failed")) {
// server-side DB failure: check derby.log / disk, then retry once after a short delay
log.error("Namespace persist failed; DB locked or unwritable", e);
} else { throw e; }
} Prevention
- Run only ONE Nacos writer against a Derby data dir (use MySQL for clusters).
- Keep the data dir on writable storage with free disk.
- Watch derby.log for lock timeouts before retrying.
When it happens
Trigger: Creating a namespace while the embedded Derby database is locked, read-only, full, or being concurrently written by another process. Also after a partial/failed schema upgrade where the tenant_info table is inconsistent.
Common situations: Two Nacos server processes pointed at the same Derby data directory (Derby is single-writer and locks exclusively); the data dir lives on read-only or full storage; a half-applied migration left the table in a bad state; derby.log shows a lock timeout.
Related errors
- SERVER_ERROR
- SERVER_ERROR
- pageNo and pageSize must be greater than zero
- fetchPageLimit error
- DATA_ACCESS_ERROR
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/0a59be2b1a0ec924.
Report an issue: GitHub.