coredns/coredns · error

database does not provide any supported schema (city, asn)

Error message

database does not provide any supported schema (city, asn)

What it means

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.

Source

Thrown at plugin/geoip/geoip.go:69

		validate func() error
	}{
		{name: "city", provides: city, validate: func() error { _, err := reader.City(probingIP); return err }},
		{name: "asn", provides: asn, validate: func() error { _, err := reader.ASN(probingIP); return err }},
	}
	// Query the database to figure out the database type.
	for _, schema := range schemas {
		if err := schema.validate(); err != nil {
			// If we get an InvalidMethodError then we know this database does not provide that schema.
			if _, ok := err.(geoip2.InvalidMethodError); !ok {
				return nil, fmt.Errorf("unexpected failure looking up database %q schema %q: %v", filepath.Base(dbPath), schema.name, err)
			}
		} else {
			db.provides |= schema.provides
		}
	}

	if db.provides == 0 {
		return nil, fmt.Errorf("database does not provide any supported schema (city, asn)")
	}

	return &GeoIP{db: db, edns0: edns0}, nil
}

// ServeDNS implements the plugin.Handler interface.
func (g GeoIP) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {
	return plugin.NextOrFailure(pluginName, g.Next, ctx, w, r)
}

// Metadata implements the metadata.Provider Interface in the metadata plugin, and is used to store
// the data associated with the source IP of every request.
func (g GeoIP) Metadata(ctx context.Context, state request.Request) context.Context {
	srcIP, err := netip.ParseAddr(state.IP())
	if err != nil {
		log.Debugf("Failed to parse source IP %q: %v", state.IP(), err)
		return ctx
	}

View on GitHub (pinned to 558c9757a9)

Solutions

  1. Use a GeoLite2-City or GeoLite2-ASN (City/ASN schema) database instead.
  2. Check which mmdb file you downloaded; Country-only dbs are not supported by these schemas.
  3. Verify with mmdbinspect or similar that the db provides the city or ASN record type.

Example fix

// before
geoip /etc/coredns/GeoLite2-Country.mmdb
// after
geoip /etc/coredns/GeoLite2-City.mmdb
Defensive patterns

Strategy: validation

Validate before calling

r, _ := geoip2.Open(dbPath)
_, cityErr := r.City(sampleIP)
_, asnErr := r.ASN(sampleIP)
if cityErr != nil && asnErr != nil {
    return fmt.Errorf("db %s provides neither City nor ASN schema", dbPath)
}

Prevention

When it happens

Trigger: 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).

Common situations: Users point the plugin at GeoLite2-Country.mmdb or an enterprise db lacking the expected schemas, or at the wrong file entirely.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of coredns/coredns@558c9757a9 (2026-09-06). Data as JSON: /api/errors/a5faf83d92a5a5ba. Report an issue: GitHub.