{"record":{"id":"0f90907603338c4b","repo":"larksuite/cli","slug":"invalid-timestamp-q-w-0f9090","errorCode":null,"errorMessage":"invalid timestamp %q: %w","messagePattern":"invalid timestamp %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/vc/vc_search.go","lineNumber":34,"sourceCode":"\t\"github.com/larksuite/cli/internal/output\"\n\t\"github.com/larksuite/cli/shortcuts/common\"\n)\n\nconst (\n\tdefaultVCSearchPageSize = 15\n\tmaxVCSearchPageSize     = 30\n\tmaxVCSearchQueryLen     = 50\n)\n\n// toRFC3339 parses a time string via ParseTime (unix timestamp) and formats it as RFC3339.\nfunc toRFC3339(input string, hint ...string) (string, error) {\n\tts, err := common.ParseTime(input, hint...)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tsec, err := strconv.ParseInt(ts, 10, 64)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"invalid timestamp %q: %w\", ts, err) //nolint:forbidigo // intermediate parse error; callers wrap it into a typed ValidationError\n\t}\n\treturn time.Unix(sec, 0).Format(time.RFC3339), nil\n}\n\n// parseTimeRange validates --start/--end and returns RFC3339 formatted strings.\nfunc parseTimeRange(runtime *common.RuntimeContext) (string, string, error) {\n\tstart := strings.TrimSpace(runtime.Str(\"start\"))\n\tend := strings.TrimSpace(runtime.Str(\"end\"))\n\tif start == \"\" && end == \"\" {\n\t\treturn \"\", \"\", nil\n\t}\n\tvar startTime, endTime string\n\tif start != \"\" {\n\t\tparsed, err := toRFC3339(start)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", errs.NewValidationError(errs.SubtypeInvalidArgument, \"--start: %v\", err).WithParam(\"--start\")\n\t\t}\n\t\tstartTime = parsed","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/vc/vc_search.go#L16-L52","documentation":"toRFC3339 converts --start/--end time input via common.ParseTime to Unix seconds, then to an RFC3339 string. If the intermediate value is not a parseable integer, it wraps the cause as 'invalid timestamp %q: %w'. This is an intermediate parse error wrapped into a typed ValidationError by parseTimeRange.","triggerScenarios":"Calling VC search with --start/--end values that ParseTime accepts but whose output is not an integer string (anomalous pass-through), since ParseTime's own failures return unwrapped before this point.","commonSituations":"Unusual or locale-specific date strings that a pass-through parser accepted, or programmatic callers feeding pre-formatted timestamps in the wrong form.","solutions":["Provide RFC3339 timestamps ('2026-09-04T00:00:00Z') or a common 'YYYY-MM-DD HH:MM' form.","Inspect the wrapped cause to see the actual strconv failure.","If passing Unix seconds directly, use a plain base-10 integer string.","Confirm accepted formats in the command's --help/schema output."],"exampleFix":"// before\n--start \"yesterday 9pm\"\n// after\n--start \"2026-09-03T21:00:00+08:00\"","handlingStrategy":"validation","validationCode":"ts, err := common.ParseTime(input)\nif err != nil { return err }\nif _, err := strconv.ParseInt(ts, 10, 64); err != nil {\n\treturn fmt.Errorf(\"--start/--end must resolve to Unix seconds, got %q\", ts)\n}","typeGuard":"func isUnixSecondsString(s string) bool {\n\t_, err := strconv.ParseInt(strings.TrimSpace(s), 10, 64)\n\treturn err == nil\n}","tryCatchPattern":"if err := run(); err != nil {\n\tvar ve *errs.ValidationError\n\tif errors.As(err, &ve) { return fmt.Errorf(\"bad time range: %w (use RFC3339)\", ve) }\n\treturn err\n}","preventionTips":["Use RFC3339 ('2026-09-04T00:00:00Z') for VC search time bounds.","Validate programmatically-composed timestamps are base-10 integers when passing raw values."],"tags":["validation","vc","timestamp","cli"],"backgroundTag":"invalid-timestamp-format","analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}