tailscale/tailscale · error

failed to parse latest version from "apk info tailscale": %w

Error message

failed to parse latest version from "apk info tailscale": %w

What it means

updateAlpineLike passes 'apk info tailscale' output to parseAlpinePackageVersion; if the parser fails, the error is re-wrapped as 'failed to parse latest version from "apk info tailscale"' so the caller knows the discovery step, not the upgrade, broke. The underlying error is either a malformed info line or 'tailscale version not found in output' from the same parser.

Source

Thrown at clientupdate/clientupdate.go:722

	}

	defer func() {
		if err != nil {
			err = fmt.Errorf(`%w; you can try updating using "apk upgrade tailscale"`, err)
		}
	}()

	out, err := exec.Command("apk", "update").CombinedOutput()
	if err != nil {
		return fmt.Errorf("failed refresh apk repository indexes: %w, output:\n%s", err, out)
	}
	out, err = exec.Command("apk", "info", "tailscale").CombinedOutput()
	if err != nil {
		return fmt.Errorf("failed checking apk for latest tailscale version: %w, output:\n%s", err, out)
	}
	ver, err := parseAlpinePackageVersion(out)
	if err != nil {
		return fmt.Errorf(`failed to parse latest version from "apk info tailscale": %w`, err)
	}
	if !up.confirm(ver) {
		if err := checkOutdatedAlpineRepo(up.Logf, apkDirPaths, ver, up.Track); err != nil {
			up.Logf("failed to check whether Alpine release is outdated: %v", err)
		}
		return nil
	}

	cmd := exec.Command("apk", "upgrade", "tailscale")
	cmd.Stdout = up.Stdout
	cmd.Stderr = up.Stderr
	if err := cmd.Run(); err != nil {
		return fmt.Errorf("failed tailscale update using apk: %w", err)
	}
	return nil
}

func parseAlpinePackageVersion(out []byte) (string, error) {

View on GitHub (pinned to cfe32b8be6)

Solutions

  1. Run 'apk info tailscale' and inspect the exact line format that starts with tailscale-
  2. Rule out localized output: run 'LC_ALL=C apk info tailscale' and retry the update
  3. If the format genuinely changed in your apk-tools version, update tailscale (newer parser) or file an issue with the exact line
  4. As a workaround upgrade manually with 'sudo apk upgrade tailscale' - the hint from the deferred wrapper
Defensive patterns

Strategy: try-catch

Validate before calling

// Sanity-check that apk's info output is parseable before updating.
out, err := exec.Command("apk", "info", "tailscale").CombinedOutput()
if err != nil {
    return err
}
found := false
for _, line := range strings.Split(string(out), "\n") {
    line = strings.TrimSpace(line)
    if strings.HasPrefix(line, "tailscale-") && len(strings.SplitN(line, "-", 3)) >= 3 {
        found = true
    }
}
if !found {
    return errors.New("apk info output has no parseable tailscale version line")
}

Try / catch

if err := up.Update(); err != nil {
    if strings.Contains(err.Error(), "failed to parse latest version from") {
        // run 'LC_ALL=C apk info tailscale' and compare the line shape;
        // fall back to instructing a manual 'apk upgrade tailscale'
    }
}

Prevention

When it happens

Trigger: 'apk info tailscale' exits zero but its output contains either a 'tailscale-'-prefixed line that does not split into at least 3 dash-separated fields (malformed info line error) or no 'tailscale-'-prefixed line at all (errors.New("tailscale version not found in output") in the same function).

Common situations: A newer apk-tools changes the info output format or wraps description lines; localized output prefixes breaking the expected 'tailscale-<ver>-<rel> description:' shape; tailscale present only as a virtual/dependency name so no version line is printed.

Understand the failure class

Related errors


AI-assisted analysis of tailscale/tailscale@cfe32b8be6 (2026-08-15). Data as JSON: /api/errors/5a295b13bf555236. Report an issue: GitHub.