{"record":{"id":"3edcbc53a0523482","repo":"lima-vm/lima","slug":"failed-to-set-timezone-w","errorCode":null,"errorMessage":"failed to set timezone: %w","messagePattern":"failed to set timezone: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/guestagent/fakecloudinit/fakecloudinit_darwin.go","lineNumber":116,"sourceCode":"\t\tlogrus.Warn(\"growpart is not implemented\")\n\t}\n\tif userData.PackageUpdate {\n\t\tlogrus.Warn(\"package_update is not implemented\")\n\t}\n\tif userData.PackageUpgrade {\n\t\tlogrus.Warn(\"package_upgrade is not implemented\")\n\t}\n\tif userData.PackageRebootIfRequired {\n\t\tlogrus.Warn(\"package_reboot_if_required is not implemented\")\n\t}\n\tfor _, m := range userData.Mounts {\n\t\tif err = mountFSTabEntry(m); err != nil {\n\t\t\terrs = append(errs, fmt.Errorf(\"failed to mount fstab entry %v: %w\", m, err))\n\t\t}\n\t}\n\tif userData.Timezone != \"\" {\n\t\tif err = setTimezone(ctx, userData.Timezone); err != nil {\n\t\t\terrs = append(errs, fmt.Errorf(\"failed to set timezone: %w\", err))\n\t\t}\n\t}\n\tfor _, u := range userData.Users {\n\t\tif err := createUser(ctx, &u); err != nil {\n\t\t\terrs = append(errs, fmt.Errorf(\"failed to create user %#q: %w\", u.Name, err))\n\t\t}\n\t}\n\tfor _, entry := range userData.WriteFiles {\n\t\tif err := writeFiles(ctx, entry); err != nil {\n\t\t\terrs = append(errs, fmt.Errorf(\"failed to write file for path %#q: %w\", entry.Path, err))\n\t\t}\n\t}\n\tif userData.ManageResolvConf && userData.ResolvConf != nil {\n\t\tif err = setResolvConf(ctx, userData.ResolvConf); err != nil {\n\t\t\terrs = append(errs, fmt.Errorf(\"failed to apply DNS configuration: %w\", err))\n\t\t}\n\t}\n\tif userData.CACerts != nil {","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/guestagent/fakecloudinit/fakecloudinit_darwin.go#L98-L134","documentation":"Raised by processUserData when the `timezone:` field is set in user-data but the macOS `systemsetup -settimezone` command fails. The command's combined output is wrapped into the underlying error by setTimezone, so the message reveals why the timezone could not be applied.","triggerScenarios":"userData.Timezone is non-empty and exec of `systemsetup -settimezone <tz>` returns non-zero: invalid timezone identifier, missing/locked systemsetup, or insufficient privileges (systemsetup typically requires root on macOS).","commonSituations":"Typo in the timezone name (e.g. `Europe/Amsterdamn` instead of `Europe/Amsterdam`), running the guest agent as a non-root user, or a managed/MDM-locked macOS image where systemsetup is restricted.","solutions":["Read the wrapped output in the error message to see systemsetup's actual complaint.","Use a valid IANA timezone identifier (check `systemsetup -listtimezones` in the VM).","Ensure the guestagent runs as root, since systemsetup requires elevated privileges.","If the timezone is not essential, remove the `timezone:` field from user-data; it is optional."],"exampleFix":"// before (user-data)\ntimezone: \"America/Los_Angeless\"\n// after\ntimezone: \"America/Los_Angeles\"","handlingStrategy":"validation","validationCode":"func validateTimezone(tz string) error {\n  if tz == \"\" { return nil }\n  valid := tzRegexp.MatchString(tz) // e.g. `^[A-Za-z]+(/[A-Za-z0-9_+-]+)+$`\n  if !valid { return fmt.Errorf(\"suspicious timezone %q\", tz) }\n  return nil\n}","typeGuard":"func isIANATimezone(s string) bool {\n  loc, err := time.LoadLocation(s)\n  return err == nil && loc != nil\n}","tryCatchPattern":"if userData.Timezone != \"\" {\n  if err := setTimezone(ctx, userData.Timezone); err != nil {\n    log.Warnf(\"timezone %q not applied, continuing: %v\", userData.Timezone, err)\n  }\n}","preventionTips":["Validate the timezone with time.LoadLocation before shipping user-data.","Run the guestagent as root; systemsetup requires privileges.","Do not treat timezone failure as fatal - it is non-essential for boot.","Check `systemsetup -listtimezones` inside the guest for the exact accepted names."],"tags":["macos","cloud-init","timezone","command-failed"],"backgroundTag":"command-execution-failed","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}