larksuite/cli · error

expected relative (7d/1m/1y), date (YYYY-MM-DD[ HH:MM:SS]),

Error message

expected relative (7d/1m/1y), date (YYYY-MM-DD[ HH:MM:SS]), RFC3339, or unix seconds

What it means

Guard in parseTimeValue: the input matches none of the accepted time formats — relative (7d/1m/1y), date (YYYY-MM-DD[ HH:MM:SS]), RFC3339, or unix seconds — so no time could be derived.

Source

Thrown at shortcuts/drive/drive_search.go:660

	}

	// Digit-only string at the end so "20260423" doesn't get misread as unix.
	// Real unix seconds for recent times are 10 digits; be conservative and
	// require length >= 10 to avoid matching YYYYMMDD. Mirror unixToISO8601's
	// ms-vs-s heuristic: 13-digit / >= 1e12 inputs are epoch-millis and get
	// normalized to seconds, otherwise a copy-pasted ms timestamp would
	// silently parse as a year-57000 unix and then trip the 1-year cap with
	// a misleading message.
	if len(s) >= 10 {
		if n, err := strconv.ParseInt(s, 10, 64); err == nil {
			if n >= 1e12 {
				n /= 1000
			}
			return n, nil
		}
	}

	return 0, fmt.Errorf("expected relative (7d/1m/1y), date (YYYY-MM-DD[ HH:MM:SS]), RFC3339, or unix seconds") //nolint:forbidigo // intermediate parse helper; caller wraps into typed ValidationError
}

func callDriveSearchAPI(runtime *common.RuntimeContext, reqBody map[string]interface{}) (map[string]interface{}, error) {
	data, err := runtime.CallAPITyped("POST", "/open-apis/search/v2/doc_wiki/search", nil, reqBody)
	if err != nil {
		return nil, enrichDriveSearchError(err)
	}
	return data, nil
}

// enrichDriveSearchError adds a +search-specific hint for a known opaque Lark
// code; other errors pass through unchanged. The hint is appended in place on
// the typed Problem, preserving its category / subtype / code / log_id.
func enrichDriveSearchError(err error) error {
	p, ok := errs.ProblemOf(err)
	if !ok || p.Code != driveSearchErrUserNotVisible {
		return err
	}

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Use one of the documented formats: 7d/1m/1y, YYYY-MM-DD[ HH:MM:SS], RFC3339, or unix seconds
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at shortcuts/drive/drive_search.go:660 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/c0b32ceac42d64dd. Report an issue: GitHub.