slackhq/nebula · error

stats.type was not understood: %s

Error message

stats.type was not understood: %s

What it means

loadStatsConfig switches on cfg.typ after handling graphite and prometheus; any other stats.type value falls to the default case and is rejected with this message. Empty or 'none' types return earlier, so this specifically means an unrecognized non-empty type string.

Source

Thrown at stats.go:366

		addr, err := net.ResolveTCPAddr(cfg.graphite.protocol, cfg.graphite.host)
		if err != nil {
			return cfg, fmt.Errorf("error while setting up graphite sink: %s", err)
		}
		cfg.graphite.resolvedAddr = addr.String()
		cfg.graphite.prefix = c.GetString("stats.prefix", "nebula")
	case "prometheus":
		cfg.prom.listen = c.GetString("stats.listen", "")
		if cfg.prom.listen == "" {
			return cfg, errors.New("stats.listen should not be empty")
		}
		cfg.prom.path = c.GetString("stats.path", "")
		if cfg.prom.path == "" {
			return cfg, errors.New("stats.path should not be empty")
		}
		cfg.prom.namespace = c.GetString("stats.namespace", "")
		cfg.prom.subsystem = c.GetString("stats.subsystem", "")
	default:
		return cfg, fmt.Errorf("stats.type was not understood: %s", cfg.typ)
	}

	return cfg, nil
}

View on GitHub (pinned to dd8f660c0a)

Solutions

  1. Set stats.type to exactly one of: graphite, prometheus, none
  2. Check casing — the comparison is case-sensitive
  3. Replace statsd-style configs with the supported prometheus listener (stats.listen) if migrating
  4. Remove the stats block entirely if metrics are not needed

Example fix

// before
stats:
  type: statsd
// after
stats:
  type: prometheus
  listen: 127.0.0.1:8080
  path: /metrics
Defensive patterns

Strategy: validation

Validate before calling

const validTypes = new Set(["", "none", "graphite", "prometheus"])
if (!validTypes.has(cfg.stats?.type ?? "none")) {
  throw new Error(`stats.type must be one of graphite|prometheus|none, got ${cfg.stats.type}`)
}

Try / catch

try {
  loadConfig(path)
} catch (e) {
  if (e.message.includes("stats.type was not understood")) {
    console.error("fix stats.type casing/spelling; supported: graphite, prometheus, none")
  }
  throw e
}

Prevention

When it happens

Trigger: stats.type is set to an unsupported value such as 'statsd', 'Graphite' (case-sensitive), 'prom', or any typo, while being non-empty.

Common situations: Copy-pasting configs from other projects that use statsd; capitalization mistakes; assuming aliases like 'prom' work.

Related errors


AI-assisted analysis of slackhq/nebula@dd8f660c0a (2026-09-03). Data as JSON: /api/errors/c3ea032951686428. Report an issue: GitHub.