tailscale/tailscale · error

Could not parse otherDate %q: %w

Error message

Could not parse otherDate %q: %w

What it means

For importer repos, otherDate is the commit timestamp captured as `git log --format=%ct` output and later parsed with strconv.ParseInt to build Apple's monotonically increasing XcodeMacOS number (275.DAY.SECONDS style). This error means the captured string was not a base-10 integer - git emitted empty or unexpected stdout for the timestamp query.

Source

Thrown at version/mkversion/mkversion.go:286

		// Technically we could populate these fields without the otherHash, but
		// these version numbers only make sense when building from Tailscale's
		// proprietary repo, so don't clutter open-source-only outputs with
		// them.
		ret.Xcode = fmt.Sprintf("%d.%d.%d", v.major+100, v.minor, v.patch)
		ret.Winres = fmt.Sprintf("%d,%d,%d,0", v.major, v.minor, v.patch)
		ret.MSIProductCodes = makeMSIProductCodes(v, track)
	}
	if v.otherDate != "" {
		ret.OtherDate = fmt.Sprintf("%s", v.otherDate)

		// Generate a monotonically increasing version number for the macOS app, as
		// expected by Apple. We use the date so that it's always increasing (if we
		// based it on the actual version number we'd run into issues when doing
		// cherrypick stable builds from a release branch after unstable builds from
		// HEAD).
		otherSec, err := strconv.ParseInt(v.otherDate, 10, 64)
		if err != nil {
			return VersionInfo{}, fmt.Errorf("Could not parse otherDate %q: %w", v.otherDate, err)
		}
		otherTime := time.Unix(otherSec, 0).UTC()
		// We started to need to do this in 2023, and the last Apple-generated
		// incrementing build number was 273. To avoid using up the space, we
		// use <year - 1750> as the major version (thus 273.*, 274.* in 2024, etc.),
		// so that we're still in the same range. This way if Apple goes back to
		// auto-incrementing the number for us, we can go back to it with
		// reasonable-looking numbers.
		// In May 2024, a build with version number 275 was uploaded to the App Store
		// by mistake, causing any 274.* build to be rejected. To address this, +1 was
		// added, causing all builds to use the 275.* prefix.
		ret.XcodeMacOS = fmt.Sprintf("%d.%d.%d", otherTime.Year()-1750+1, otherTime.YearDay(), otherTime.Hour()*60*60+otherTime.Minute()*60+otherTime.Second())
	}

	return ret, nil
}

// makeMSIProductCodes produces per-architecture v5 UUIDs derived from the pkgs

View on GitHub (pinned to 6e0912f979)

Solutions

  1. Run `git log -n1 --format=%ct HEAD` in your repo and inspect stdout for anything non-numeric
  2. Remove git aliases/wrappers or env like GIT_PAGER/GIT_TRACE that could pollute stdout
  3. Upgrade/normalize git in the build environment to an official build

Example fix

# before
$ git log -n1 --format=%ct HEAD
warning: using slow parser  # wrapper noise -> Could not parse otherDate

# after (plain git)
$ git log -n1 --format=%ct HEAD
1755500000
Defensive patterns

Strategy: try-catch

Validate before calling

// Sanity-check that git emits a clean unix timestamp in this repo.
out, err := exec.Command("git", "-C", dir, "log", "-n1", "--format=%ct", "HEAD").Output()
if err != nil {
	return err
}
if _, err := strconv.ParseInt(strings.TrimSpace(string(out)), 10, 64); err != nil {
	return fmt.Errorf("git wrapper pollutes stdout; fix git environment: %w", err)
}
v, err := mkversion.InfoFrom(dir)

Type guard

func isOtherDateParseError(err error) bool {
	return err != nil && strings.Contains(err.Error(), "Could not parse otherDate")
}

Try / catch

v, err := mkversion.InfoFrom(dir)
if err != nil {
	if isOtherDateParseError(err) {
		// Environment problem (git wrapper), not a code problem.
		log.Printf("unexpected git output; run `git log -n1 --format=%ct HEAD` to inspect: %v", err)
	}
	return err
}

Prevention

When it happens

Trigger: A git wrapper/alias/shim in PATH that prints extra text to stdout, an exotic or broken git build, or (rarely) output that is empty because HEAD resolution produced nothing on stdout while succeeding.

Common situations: Corporate machines with git wrappers; CI images with unusual git builds; environments where GIT_* env vars alter log output.

Related errors


AI-assisted analysis of tailscale/tailscale@6e0912f979 (2026-08-18). Data as JSON: /api/errors/7c7b3eb5d6d353cc. Report an issue: GitHub.