{"record":{"id":"0378d8d8fbb37aef","repo":"elastic/elasticsearch","slug":"invalid-database-configuration-id-id-doesn-t","errorCode":null,"errorMessage":"invalid database configuration id [{}]: id doesn't match required rules (alphanumerics, dashes, and underscores, only)","messagePattern":"invalid database configuration id \\[(.+?)\\]: id doesn't match required rules \\(alphanumerics, dashes, and underscores, only\\)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/ip-location/src/main/java/org/elasticsearch/ingest/geoip/direct/DatabaseConfiguration.java","lineNumber":182,"sourceCode":"     * An id is intended to be alphanumerics, dashes, and underscores (only), but we're reserving leading dashes and underscores for\n     * ourselves in the future, that is, they're not for the ones that users can PUT.\n     */\n    static void validateId(String id) throws IllegalArgumentException {\n        if (Strings.isNullOrEmpty(id)) {\n            throw new IllegalArgumentException(\"invalid database configuration id [\" + id + \"]: must not be null or empty\");\n        }\n        MetadataCreateIndexService.validateIndexOrAliasName(\n            id,\n            (id1, description) -> new IllegalArgumentException(\"invalid database configuration id [\" + id1 + \"]: \" + description)\n        );\n        int byteCount = id.getBytes(StandardCharsets.UTF_8).length;\n        if (byteCount > 127) {\n            throw new IllegalArgumentException(\n                \"invalid database configuration id [\" + id + \"]: id is too long, (\" + byteCount + \" > \" + 127 + \")\"\n            );\n        }\n        if (ID_PATTERN.matcher(id).matches() == false) {\n            throw new IllegalArgumentException(\n                \"invalid database configuration id [\"\n                    + id\n                    + \"]: id doesn't match required rules (alphanumerics, dashes, and underscores, only)\"\n            );\n        }\n    }\n\n    public ActionRequestValidationException validate() {\n        ActionRequestValidationException err = new ActionRequestValidationException();\n\n        // how do we cross the id validation divide here? or do we? it seems unfortunate to not invoke it at all.\n\n        // name validation\n        if (Strings.hasText(name) == false) {\n            err.addValidationError(\"invalid name [\" + name + \"]: cannot be empty\");\n        }\n\n        // provider-specific name validation","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/ip-location/src/main/java/org/elasticsearch/ingest/geoip/direct/DatabaseConfiguration.java#L164-L200","documentation":"Thrown by DatabaseConfiguration.validateId when the id does not match ID_PATTERN (\\\\p{Alnum}[_\\\\-\\\\p{Alnum}]{0,126}). The id must START with an alphanumeric character and may contain only alphanumerics, dashes, and underscores thereafter. Leading dashes and underscores are explicitly reserved by Elasticsearch for future internal use and are rejected even though they technically match a loose reading.","triggerScenarios":"PUT _ingest/geoip/database/<id> where <id> contains dots, spaces, slashes, or other special characters, or begins with a dash/underscore. Examples that fail: 'my.db', 'my db', '-city', '_internal', 'city!', 'café'.","commonSituations":"Using index-style names with dots; copying an id from another system that permits leading underscores; URL-decoding artifacts introducing spaces; i18n names with accented characters.","solutions":["Rename the id to start with a letter/digit and use only [A-Za-z0-9_-], e.g. 'city-db' or 'geoip_city_01'.","Remove leading dashes and underscores: '_city' -> 'city', '-internal' -> 'internal'.","Strip or replace disallowed characters (dots, spaces, accents) before submitting the id."],"exampleFix":"// before\nPUT _ingest/geoip/database/my.geoip.city\n\n// after\nPUT _ingest/geoip/database/my-geoip-city","handlingStrategy":"validation","validationCode":"// ID_PATTERN = \\\\p{Alnum}[_\\\\-\\\\p{Alnum}]{0,126}\nprivate static final Pattern ID_OK = Pattern.compile(\"\\\\p{Alnum}[_\\\\-\\\\p{Alnum}]{0,126}\");\nString id = requestConfig.getId();\nif (!ID_OK.matcher(id).matches()) {\n    throw new IllegalArgumentException(\"id must be alphanumerics, dashes, underscores; must start with alphanumeric\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Start ids with a letter or digit; never a dash or underscore.","Avoid dots, spaces, slashes, and accented characters in ids.","Sanitize generated ids by replacing disallowed chars with '-' before submitting."],"tags":["elasticsearch","geoip","validation","configuration-id","pattern","rest-api"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}