larksuite/cli · error

empty value

Error message

empty value

What it means

Guard in parseTimeValue: the time-value input is empty or whitespace-only. Caller wraps this intermediate error into a typed flag validation error.

Source

Thrown at shortcuts/drive/drive_search.go:615

func floorHour(unix int64) int64 {
	return unix - (unix % 3600)
}

func ceilHour(unix int64) int64 {
	if unix%3600 == 0 {
		return unix
	}
	return floorHour(unix) + 3600
}

var driveSearchRelativeRe = regexp.MustCompile(`^(\d+)([dmy])$`)

// parseTimeValue accepts relative (7d, 1m=30d, 1y=365d), absolute dates in a
// few common layouts, RFC3339, and raw unix seconds.
func parseTimeValue(input string, now time.Time) (int64, error) {
	s := strings.TrimSpace(input)
	if s == "" {
		return 0, fmt.Errorf("empty value") //nolint:forbidigo // intermediate parse helper; caller wraps into typed ValidationError
	}

	if m := driveSearchRelativeRe.FindStringSubmatch(s); m != nil {
		n, _ := strconv.Atoi(m[1])
		var days int
		switch m[2] {
		case "d":
			days = n
		case "m":
			days = n * 30
		case "y":
			days = n * 365
		}
		return now.Add(-time.Duration(days) * 24 * time.Hour).Unix(), nil
	}

	layouts := []string{
		time.RFC3339,

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Pass a relative (7d), date, RFC3339, or unix-seconds value
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at shortcuts/drive/drive_search.go:615 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04). Data as JSON: /api/errors/f881638d3615bd48. Report an issue: GitHub.