hashicorp/nomad · info

DriverStatsNotImplemented

DriverStatsNotImplemented

Error message

stats not implemented for driver

What it means

DriverStatsNotImplemented is a sentinel error (var in client/structs/structs.go) returned by task driver plugins that do not implement the Stats() RPC. The task runner's stats hook compares err.Error() against this sentinel by string and downgrades it to a Debug log, so it is a normal signal, not a failure. Callers should use errors.Is or string comparison against this exact value.

Source

Thrown at client/structs/structs.go:406

}

// AddDriverInfo adds information about a driver to the fingerprint response.
// If the Drivers field has not yet been initialized, it does so here.
func (h *HealthCheckResponse) AddDriverInfo(name string, driverInfo *structs.DriverInfo) {
	// initialize Drivers if it has not been already
	if h.Drivers == nil {
		h.Drivers = make(map[string]*structs.DriverInfo)
	}

	h.Drivers[name] = driverInfo
}

// CheckBufSize is the size of the buffer that is used for job output
const CheckBufSize = 4 * 1024

// DriverStatsNotImplemented is the error to be returned if a driver doesn't
// implement stats.
var DriverStatsNotImplemented = errors.New("stats not implemented for driver")

// NodeRegistration stores data about the client's registration with the server
type NodeRegistration struct {
	HasRegistered bool
}

type ConsulACLToken struct {
	Cluster  string
	TokenID  string
	ACLToken string
}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Verify the driver plugin actually implements the Stats RPC and the TaskDriver has stats capability
  2. If the driver legitimately lacks stats, treat this as expected — suppress or handle it like the stats hook does (log at debug and continue)
  3. Update the driver plugin to a version that implements stats if per-task statistics are required
  4. Match on the sentinel exactly (err.Error() == cstructs.DriverStatsNotImplemented.Error()) rather than parsing the message

Example fix

// before
stats, err := driver.Stats(ctx, "0")
if err != nil {
	return err // treats "stats not implemented" as a real failure
}
// after
stats, err := driver.Stats(ctx, "0")
if err != nil {
	if err.Error() == cstructs.DriverStatsNotImplemented.Error() {
		logger.Debug("driver does not support stats")
		return nil
	}
	return err
}
Defensive patterns

Strategy: type-guard

Validate before calling

// Sentinel is predeclared; check driver capability before calling:
// driver capabilities: does it advertise Stats support?
var driverStatsNotImplementedMsg = cstructs.DriverStatsNotImplemented.Error()

Type guard

func isStatsNotImplemented(err error) bool {
	return err != nil && err.Error() == cstructs.DriverStatsNotImplemented.Error()
}

Try / catch

stats, err := driver.Stats(ctx, interval)
if isStatsNotImplemented(err) {
	logger.Debug("driver does not support stats")
	return nil
} else if err != nil {
	return err
}

Prevention

When it happens

Trigger: Calling ClientStats()/driver Stats() on a driver whose TaskDriver does not implement the stats capability (e.g. raw_exec or older/custom drivers without stats support); the retry wrapper callStatsWithRetry propagates it after exhausting retries.

Common situations: Running workloads on drivers lacking stats support while the job's UI/monitor requests resource statistics; upgrading Nomad where a driver plugin predates the stats API; third-party driver plugins with incomplete feature support.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/80f1adb9421c98a2. Report an issue: GitHub.