{"record":{"id":"1eff03d0f376ce13","repo":"lima-vm/lima","slug":"timesync-not-supported-on-this-platform","errorCode":null,"errorMessage":"timesync: not supported on this platform","messagePattern":"timesync: not supported on this platform","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"pkg/guestagent/timesync/timesync_others.go","lineNumber":13,"sourceCode":"// SPDX-FileCopyrightText: Copyright The Lima Authors\n// SPDX-License-Identifier: Apache-2.0\n\n//go:build !linux\n\npackage timesync\n\nimport (\n\t\"errors\"\n\t\"time\"\n)\n\nvar errNotSupported = errors.New(\"timesync: not supported on this platform\")\n\nfunc SetSystemTime(_ time.Time) error {\n\treturn errNotSupported\n}\n","sourceCodeStart":1,"sourceCodeEnd":18,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/guestagent/timesync/timesync_others.go#L1-L18","documentation":"The timesync package only implements SetSystemTime on platforms with the required clock-setting capability (e.g. Linux). On other platforms a sentinel error errNotSupported is returned, signaling the guestagent to skip time synchronization instead of failing.","triggerScenarios":"SetSystemTime called on any build of pkg/guestagent/timesync/timesync_others.go (non-Linux GOOS) whenever the guestagent attempts a time sync.","commonSituations":"Running or developing the guestagent on macOS/BSD/Windows builds; CI compiling for multiple GOOS; a host clock drift handler invoking SetSystemTime on an unsupported guest OS.","solutions":["Treat this as a no-op: callers should log and skip timesync on unsupported platforms.","Use build-tag-specific code paths so timesync is only invoked where supported.","If time sync is needed, implement a platform-specific SetSystemTime (e.g. via `date`/system APIs) in a new _GOOS file."],"exampleFix":"// before: assuming success\ncaller.SetSystemTime(now)\n// after: tolerate unsupported platforms\nif err := timesync.SetSystemTime(now); err != nil && !errors.Is(err, timesync.ErrNotSupported) {\n\tlogrus.WithError(err).Warn(\"failed to set system time\")\n}","handlingStrategy":"try-catch","validationCode":"// gate timesync calls on build tags\n//go:build linux\n// timesync only invoked in linux-built paths; use runtime.GOOS at runtime otherwise\nif runtime.GOOS != \"linux\" {\n\treturn // timesync unsupported\n}","typeGuard":null,"tryCatchPattern":"if err := timesync.SetSystemTime(t); err != nil {\n\tif errors.Is(err, errNotSupported) {\n\t\tlog.Debug(\"timesync unsupported on this platform; skipping\")\n\t\treturn\n\t}\n\tlog.WithError(err).Warn(\"failed to set system time\")\n}","preventionTips":["Use per-platform build tags so timesync is only called where supported.","Check errors.Is(err, errNotSupported) and treat as an expected no-op.","Don't alarm/retire the agent for this sentinel error.","Add platform coverage to CI to catch accidental calls on unsupported GOOS."],"tags":["guestagent","timesync","platform-compat"],"backgroundTag":"not-supported-on-this-platform","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}