temporalio/temporal · error
%s is not a valid timestamp: %w
Error message
%s is not a valid timestamp: %w
What it means
Generic helper validateTimestamp wraps timestamppb.Timestamp.CheckValid() failures with the field name (e.g. 'start time', 'end time'). A timestamp fails CheckValid when it is nil-valued fields, out-of-range seconds/nanos, or otherwise not a valid RFC3339-representable time.
Source
Thrown at service/frontend/workflow_handler.go:7038
if err := d.CheckValid(); err != nil {
return fmt.Errorf("phase is not a valid duration: %w", err)
}
}
}
return nil
}
func validateScheduleTimestamps(spec *schedulepb.ScheduleSpec) error {
if err := validateTimestamp(spec.GetStartTime(), "start time"); err != nil {
return err
}
return validateTimestamp(spec.GetEndTime(), "end time")
}
func validateTimestamp(value *timestamppb.Timestamp, field string) error {
if value != nil {
if err := value.CheckValid(); err != nil {
return fmt.Errorf("%s is not a valid timestamp: %w", field, err)
}
}
return nil
}
func validateScheduleRemainingActions(schedule *schedulepb.Schedule) error {
if schedule.GetState().GetRemainingActions() < 0 {
return errors.New("remaining actions cannot be negative")
}
return nil
}
func validateScheduleOverlapPolicy(policy enumspb.ScheduleOverlapPolicy, field string) error {
if _, ok := enumspb.ScheduleOverlapPolicy_name[int32(policy)]; !ok {
return fmt.Errorf("%s has unsupported overlap policy %v", field, policy)
}
return nil
}View on GitHub (pinned to bde624efd1)
Solutions
- Use timestamppb.New(t) from a valid time.Time
- Check ts.CheckValid() or timestamppb.Timestamp IsValid before the call
- Verify epoch conversion math (seconds vs milliseconds) when hand-building timestamps
Example fix
// before
ts := ×tamppb.Timestamp{Seconds: 99999999999999999999}
// after
ts := timestamppb.New(time.Now().UTC().Add(24 * time.Hour)) Defensive patterns
Strategy: validation
Validate before calling
if ts != nil && ts.CheckValid() != nil { return fmt.Errorf("invalid timestamp for %s", field) } Type guard
func validTimestamp(ts *timestamppb.Timestamp) bool { return ts == nil || ts.IsValid() } Try / catch
if err := validateTimestamp(spec.GetEndTime(), "end time"); err != nil { return serviceerror.NewInvalidArgument(err.Error()) } Prevention
- Construct timestamps with timestamppb.New(time.Time)
- Call ts.CheckValid() before sending requests
- Audit epoch conversions for seconds-vs-millis mistakes
When it happens
Trigger: Schedule API calls passing a ScheduleSpec with StartTime/EndTime (or other validated timestamps) built from malformed or out-of-range protobuf Timestamp values.
Common situations: Converting from milliseconds-since-epoch incorrectly; overflow when converting int64 seconds; passing a zero timestamp from an uninitialized struct.
Related errors
- interval is not a valid duration: %w
- phase is not a valid duration: %w
- %s has unsupported overlap policy %v
- remaining actions cannot be negative
- batchParams is nil
AI-assisted analysis of temporalio/temporal@bde624efd1 (2026-09-01).
Data as JSON: /api/errors/f40540c5daa5285d.
Report an issue: GitHub.