{"record":{"id":"257faf5d7589fd62","repo":"elastic/elasticsearch","slug":"invalid-database-configuration-id-must-not-b","errorCode":null,"errorMessage":"invalid database configuration id [{}]: must not be null or empty","messagePattern":"invalid database configuration id \\[(.+?)\\]: must not be null or empty","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/ip-location/src/main/java/org/elasticsearch/ingest/geoip/direct/DatabaseConfiguration.java","lineNumber":169,"sourceCode":"        out.writeNamedWriteable(provider);\n    }\n\n    @Override\n    public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {\n        builder.startObject();\n        builder.field(\"name\", name);\n        builder.field(provider.getWriteableName(), provider);\n        builder.endObject();\n        return builder;\n    }\n\n    /**\n     * 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        }","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/ip-location/src/main/java/org/elasticsearch/ingest/geoip/direct/DatabaseConfiguration.java#L151-L187","documentation":"Thrown by DatabaseConfiguration.validateId when the GeoIP database configuration id is null or empty. The id is the URL path segment of the PUT/DELETE _ingest/geoip/database configuration API and must be supplied as a non-blank string. This is the first guard in a chain that also checks index-name validity, byte length, and an alphanumeric/dash/underscore pattern.","triggerScenarios":"Calling PUT _ingest/geoip/database/<id> (or DELETE) where <id> is omitted, an empty string, or whitespace-only. The id is parsed from the REST path before the body is read, so a malformed URL like PUT _ingest/geoip/database/ with nothing after the last slash hits this.","commonSituations":"URL-templating bugs in client code that leave the id blank; copy/paste of an API example with a placeholder never replaced; automated scripts that build the path from an unset variable; retry logic that drops the id on a second attempt.","solutions":["Supply a non-empty id in the request path, e.g. PUT _ingest/geoip/database/my-city-db.","If generating the id programmatically, default it to a stable name and assert it is non-blank before issuing the request.","Check the client SDK call site that constructs the path for a null/empty variable substitution."],"exampleFix":"// before\nPUT _ingest/geoip/database/\n{ \"name\": \"City\", \"maxmind\": { \"account_id\": \"123\" } }\n\n// after\nPUT _ingest/geoip/database/my-city-db\n{ \"name\": \"City\", \"maxmind\": { \"account_id\": \"123\" } }","handlingStrategy":"validation","validationCode":"// Validate the GeoIP database config id before issuing PUT/DELETE\nString id = requestConfig.getId();\nif (id == null || id.trim().isEmpty()) {\n    throw new IllegalArgumentException(\"GeoIP database configuration id must not be null or empty\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass an explicit id segment in the _ingest/geoip/database/<id> URL path.","Assert the id is non-blank in client code before building the request URL.","Use the same id consistently for create/update to avoid empty-substitution bugs."],"tags":["elasticsearch","geoip","validation","configuration-id","rest-api"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:31:55.035Z"}