{"record":{"id":"a5faf83d92a5a5ba","repo":"coredns/coredns","slug":"database-does-not-provide-any-supported-schema-ci","errorCode":null,"errorMessage":"database does not provide any supported schema (city, asn)","messagePattern":"database does not provide any supported schema \\(city, asn\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/geoip/geoip.go","lineNumber":69,"sourceCode":"\t\tvalidate func() error\n\t}{\n\t\t{name: \"city\", provides: city, validate: func() error { _, err := reader.City(probingIP); return err }},\n\t\t{name: \"asn\", provides: asn, validate: func() error { _, err := reader.ASN(probingIP); return err }},\n\t}\n\t// Query the database to figure out the database type.\n\tfor _, schema := range schemas {\n\t\tif err := schema.validate(); err != nil {\n\t\t\t// If we get an InvalidMethodError then we know this database does not provide that schema.\n\t\t\tif _, ok := err.(geoip2.InvalidMethodError); !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected failure looking up database %q schema %q: %v\", filepath.Base(dbPath), schema.name, err)\n\t\t\t}\n\t\t} else {\n\t\t\tdb.provides |= schema.provides\n\t\t}\n\t}\n\n\tif db.provides == 0 {\n\t\treturn nil, fmt.Errorf(\"database does not provide any supported schema (city, asn)\")\n\t}\n\n\treturn &GeoIP{db: db, edns0: edns0}, nil\n}\n\n// ServeDNS implements the plugin.Handler interface.\nfunc (g GeoIP) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {\n\treturn plugin.NextOrFailure(pluginName, g.Next, ctx, w, r)\n}\n\n// Metadata implements the metadata.Provider Interface in the metadata plugin, and is used to store\n// the data associated with the source IP of every request.\nfunc (g GeoIP) Metadata(ctx context.Context, state request.Request) context.Context {\n\tsrcIP, err := netip.ParseAddr(state.IP())\n\tif err != nil {\n\t\tlog.Debugf(\"Failed to parse source IP %q: %v\", state.IP(), err)\n\t\treturn ctx\n\t}","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/coredns/coredns/blob/558c9757a92b361e550bdba82d0b4ddf3d12d595/plugin/geoip/geoip.go#L51-L87","documentation":"After probing all schemas, if none of the City/ASN validation probes succeeded (db.provides == 0), the database is not a supported MaxMind database type and the plugin refuses to start with this error.","triggerScenarios":"Configuring the geoip plugin with a database file that is a valid mmdb but of an unsupported type (e.g. GeoLite2-Country or a custom db without City/ASN schemas).","commonSituations":"Users point the plugin at GeoLite2-Country.mmdb or an enterprise db lacking the expected schemas, or at the wrong file entirely.","solutions":["Use a GeoLite2-City or GeoLite2-ASN (City/ASN schema) database instead.","Check which mmdb file you downloaded; Country-only dbs are not supported by these schemas.","Verify with mmdbinspect or similar that the db provides the city or ASN record type."],"exampleFix":"// before\ngeoip /etc/coredns/GeoLite2-Country.mmdb\n// after\ngeoip /etc/coredns/GeoLite2-City.mmdb","handlingStrategy":"validation","validationCode":"r, _ := geoip2.Open(dbPath)\n_, cityErr := r.City(sampleIP)\n_, asnErr := r.ASN(sampleIP)\nif cityErr != nil && asnErr != nil {\n    return fmt.Errorf(\"db %s provides neither City nor ASN schema\", dbPath)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use GeoLite2-City or GeoLite2-ASN databases","Do not use Country-only databases","Verify db type with mmdbinspect before configuring"],"tags":["coredns","geoip","configuration"],"backgroundTag":"unsupported-operation","analyzedSha":"558c9757a92b361e550bdba82d0b4ddf3d12d595","analyzedAt":"2026-09-06T22:47:02.106Z","contentChangedAt":"2026-09-06T22:47:02.106Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}