{"record":{"id":"15cd1eb86efae3de","repo":"elastic/elasticsearch","slug":"unexpected-provider-s-for-configuration-s","errorCode":null,"errorMessage":"Unexpected provider [%s] for configuration [%s]","messagePattern":"Unexpected provider \\[(.+?)\\] for configuration \\[(.+?)\\]","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/ip-location/src/main/java/org/elasticsearch/ingest/geoip/EnterpriseGeoIpDownloader.java","lineNumber":436,"sourceCode":"            .filter(e -> e.getValue().isNewEnough(clusterService.state().metadata().settings()) == false)\n            .map(entry -> Tuple.tuple(entry.getKey(), entry.getValue()))\n            .toList();\n        expiredDatabases.forEach(e -> {\n            String name = e.v1();\n            Metadata meta = e.v2();\n            deleteOldChunks(name, meta.lastChunk() + 1);\n            state = state.put(name, new Metadata(meta.lastUpdate(), meta.firstChunk(), meta.lastChunk(), meta.md5(), meta.lastCheck() - 1));\n            updateTaskState();\n        });\n    }\n\n    private ProviderDownload downloaderFor(DatabaseConfiguration database) {\n        if (database.provider() instanceof DatabaseConfiguration.Maxmind maxmind) {\n            return new MaxmindDownload(database.name(), maxmind);\n        } else if (database.provider() instanceof DatabaseConfiguration.Ipinfo ipinfo) {\n            return new IpinfoDownload(database.name(), ipinfo);\n        } else {\n            throw new IllegalArgumentException(\n                Strings.format(\"Unexpected provider [%s] for configuration [%s]\", database.provider().getClass(), database.id())\n            );\n        }\n    }\n\n    class MaxmindDownload implements ProviderDownload {\n\n        final String name;\n        final DatabaseConfiguration.Maxmind maxmind;\n        HttpClient.PasswordAuthenticationHolder auth;\n\n        MaxmindDownload(String name, DatabaseConfiguration.Maxmind maxmind) {\n            this.name = name;\n            this.maxmind = maxmind;\n            this.auth = buildCredentials();\n        }\n\n        @Override","sourceCodeStart":418,"sourceCodeEnd":454,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/ip-location/src/main/java/org/elasticsearch/ingest/geoip/EnterpriseGeoIpDownloader.java#L418-L454","documentation":"Thrown by EnterpriseGeoIpDownloader.downloaderFor when a DatabaseConfiguration's provider is neither Maxmind nor Ipinfo. The enterprise downloader only knows how to fetch from those two remote providers; any other provider subtype (Web, Local, or a future type) has no download strategy. This is an IllegalArgumentException surfaced during updateDatabases(), so it fails that database's update but the executor catches and logs it.","triggerScenarios":"A DatabaseConfiguration created with a Web or Local provider is processed by the EnterpriseGeoIpDownloaderTaskExecutor (e.g. via updateDatabases -> downloadAndIndex -> downloaderFor). The instanceof chain falls through to the else branch.","commonSituations":"Mixing the enterprise downloader with non-remote providers; a future provider type added to DatabaseConfiguration without a matching branch here; a test fixture that constructs a Local/Web provider and routes it through the enterprise path.","solutions":["Only register Maxmind or Ipinfo providers with the enterprise geoip downloader; use the local/Web code paths for other provider types.","If you added a new provider subtype, extend downloaderFor with a branch returning a new ProviderDownload implementation.","Audit the database configurations stored in the cluster state to find and remove/replace the offending configuration whose id is named in the message."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"boolean isRemoteDownloadSupported(DatabaseConfiguration db) {\n    var p = db.provider();\n    return p instanceof DatabaseConfiguration.Maxmind || p instanceof DatabaseConfiguration.Ipinfo;\n}","typeGuard":null,"tryCatchPattern":"try {\n    ProviderDownload pd = downloader.downloaderFor(db);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Unexpected provider\")) {\n        // skip or reroute non-remote providers; do not feed Web/Local to the enterprise path\n        logger.warn(\"skipping non-remote provider [{}]\", db.id());\n    } else throw e;\n}","preventionTips":["Only register Maxmind/Ipinfo configurations with the enterprise downloader.","When adding a new provider subtype, add the matching branch in downloaderFor in the same change.","Validate provider type before invoking the enterprise download path."],"tags":["geoip","provider","configuration","enum-exhaustiveness"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}