elastic/elasticsearch · error · IllegalArgumentException
invalid database configuration id [{}]: id is too long, ({}
Error message
invalid database configuration id [{}]: id is too long, ({} > 127) What it means
Thrown by DatabaseConfiguration.validateId when the id exceeds 127 bytes when encoded as UTF-8. The 127-byte ceiling is a hard limit (note ID_PATTERN also caps at 127 characters) chosen to keep ids filesystem- and index-name-safe. Multi-byte characters (e.g. Unicode) count by byte length, not character count.
Source
Thrown at modules/ip-location/src/main/java/org/elasticsearch/ingest/geoip/direct/DatabaseConfiguration.java:177
builder.endObject();
return builder;
}
/**
* An id is intended to be alphanumerics, dashes, and underscores (only), but we're reserving leading dashes and underscores for
* ourselves in the future, that is, they're not for the ones that users can PUT.
*/
static void validateId(String id) throws IllegalArgumentException {
if (Strings.isNullOrEmpty(id)) {
throw new IllegalArgumentException("invalid database configuration id [" + id + "]: must not be null or empty");
}
MetadataCreateIndexService.validateIndexOrAliasName(
id,
(id1, description) -> new IllegalArgumentException("invalid database configuration id [" + id1 + "]: " + description)
);
int byteCount = id.getBytes(StandardCharsets.UTF_8).length;
if (byteCount > 127) {
throw new IllegalArgumentException(
"invalid database configuration id [" + id + "]: id is too long, (" + byteCount + " > " + 127 + ")"
);
}
if (ID_PATTERN.matcher(id).matches() == false) {
throw new IllegalArgumentException(
"invalid database configuration id ["
+ id
+ "]: id doesn't match required rules (alphanumerics, dashes, and underscores, only)"
);
}
}
public ActionRequestValidationException validate() {
ActionRequestValidationException err = new ActionRequestValidationException();
// how do we cross the id validation divide here? or do we? it seems unfortunate to not invoke it at all.
// name validationView on GitHub (pinned to db6a809a66)
Solutions
- Shorten the id to 127 UTF-8 bytes or fewer; prefer concise, human-readable names like 'city-db'.
- If ids are generated, truncate or hash long inputs to a fixed short length before sending.
- Count bytes (not chars) when validating client-side: id.getBytes(StandardCharsets.UTF_8).length <= 127.
Example fix
// before PUT _ingest/geoip/database/my-very-long-geoip-database-configuration-identifier-that-exceeds-the-allowed-byte-limit-of-one-hundred-twenty-seven // after PUT _ingest/geoip/database/city-db
Defensive patterns
Strategy: validation
Validate before calling
String id = requestConfig.getId();
int byteLen = id.getBytes(StandardCharsets.UTF_8).length;
if (byteLen > 127) {
throw new IllegalArgumentException("id is " + byteLen + " UTF-8 bytes; max is 127");
} Prevention
- Keep ids short and ASCII-only to avoid byte-vs-char surprises.
- If ids are generated, cap their source length and hash/truncate to a safe bound.
- Validate byte length client-side, not character length, for non-ASCII names.
When it happens
Trigger: PUT _ingest/geoip/database/<id> with an id longer than 127 UTF-8 bytes. Non-ASCII characters inflate the byte count faster than the character count, so a visually short Unicode id can still exceed the limit.
Common situations: Auto-generated ids that concatenate long prefixes/suffixes; templated ids that embed tenant + region + timestamp; Unicode ids that look short but are multi-byte.
Related errors
- invalid database configuration id [{}]: must not be null or
- invalid database configuration id [{}]: id doesn't match req
- field [{}] is null, cannot extract geoip information.
- array in field [{}] should only contain strings
- field [{}] should contain only string or array of strings
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/8bd75e707b7da172.
Report an issue: GitHub.