{"record":{"id":"80f1adb9421c98a2","repo":"hashicorp/nomad","slug":"driverstatsnotimplemented","errorCode":"DriverStatsNotImplemented","errorMessage":"stats not implemented for driver","messagePattern":"stats not implemented for driver","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"info","filePath":"client/structs/structs.go","lineNumber":406,"sourceCode":"}\n\n// AddDriverInfo adds information about a driver to the fingerprint response.\n// If the Drivers field has not yet been initialized, it does so here.\nfunc (h *HealthCheckResponse) AddDriverInfo(name string, driverInfo *structs.DriverInfo) {\n\t// initialize Drivers if it has not been already\n\tif h.Drivers == nil {\n\t\th.Drivers = make(map[string]*structs.DriverInfo)\n\t}\n\n\th.Drivers[name] = driverInfo\n}\n\n// CheckBufSize is the size of the buffer that is used for job output\nconst CheckBufSize = 4 * 1024\n\n// DriverStatsNotImplemented is the error to be returned if a driver doesn't\n// implement stats.\nvar DriverStatsNotImplemented = errors.New(\"stats not implemented for driver\")\n\n// NodeRegistration stores data about the client's registration with the server\ntype NodeRegistration struct {\n\tHasRegistered bool\n}\n\ntype ConsulACLToken struct {\n\tCluster  string\n\tTokenID  string\n\tACLToken string\n}\n","sourceCodeStart":388,"sourceCodeEnd":418,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/structs/structs.go#L388-L418","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the driver plugin actually implements the Stats RPC and the TaskDriver has stats capability","If the driver legitimately lacks stats, treat this as expected — suppress or handle it like the stats hook does (log at debug and continue)","Update the driver plugin to a version that implements stats if per-task statistics are required","Match on the sentinel exactly (err.Error() == cstructs.DriverStatsNotImplemented.Error()) rather than parsing the message"],"exampleFix":"// before\nstats, err := driver.Stats(ctx, \"0\")\nif err != nil {\n\treturn err // treats \"stats not implemented\" as a real failure\n}\n// after\nstats, err := driver.Stats(ctx, \"0\")\nif err != nil {\n\tif err.Error() == cstructs.DriverStatsNotImplemented.Error() {\n\t\tlogger.Debug(\"driver does not support stats\")\n\t\treturn nil\n\t}\n\treturn err\n}","handlingStrategy":"type-guard","validationCode":"// Sentinel is predeclared; check driver capability before calling:\n// driver capabilities: does it advertise Stats support?\nvar driverStatsNotImplementedMsg = cstructs.DriverStatsNotImplemented.Error()","typeGuard":"func isStatsNotImplemented(err error) bool {\n\treturn err != nil && err.Error() == cstructs.DriverStatsNotImplemented.Error()\n}","tryCatchPattern":"stats, err := driver.Stats(ctx, interval)\nif isStatsNotImplemented(err) {\n\tlogger.Debug(\"driver does not support stats\")\n\treturn nil\n} else if err != nil {\n\treturn err\n}","preventionTips":["Compare against the exported sentinel (or its exact message), never a hand-typed string","Treat this error as informational: skip stats collection instead of failing the task","When choosing drivers, check whether they implement the Stats RPC if task metrics matter to you"],"tags":["nomad","driver","stats","sentinel-error"],"backgroundTag":"driver-stats-not-implemented","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}