SigNoz/signoz · warning · errors SigNozError

ErrCodeTokenOlderLastObservedAt

ErrCodeTokenOlderLastObservedAt

Error message

last observed at is before the current last observed at

What it means

Returned by Token.UpdateLastObservedAt when the supplied timestamp is older than the token's current LastObservedAt. Last-observed timestamps must be monotonic to keep idle-expiry correct.

Source

Thrown at pkg/types/authtypes/token.go:207

	typ.RotatedAt = time.Now()

	// Set the updated at time.
	typ.UpdatedAt = time.Now()

	return nil
}

func (typ *Token) RotationAt(rotationInterval time.Duration) time.Time {
	if typ.RotatedAt.IsZero() {
		return typ.CreatedAt.Add(rotationInterval)
	}

	return typ.RotatedAt.Add(rotationInterval)
}

func (typ *Token) UpdateLastObservedAt(lastObservedAt time.Time) error {
	if lastObservedAt.Before(typ.LastObservedAt) {
		return errors.New(errors.TypeInvalidInput, ErrCodeTokenOlderLastObservedAt, "last observed at is before the current last observed at")
	}

	typ.LastObservedAt = lastObservedAt
	typ.UpdatedAt = time.Now()

	return nil
}

func (typ Token) MarshalBinary() ([]byte, error) {
	return json.Marshal(typ)
}

func (typ *Token) UnmarshalBinary(data []byte) error {
	return json.Unmarshal(data, typ)
}

type TokenStore interface {
	// Create a new token.

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Only send timestamps that are >= the stored LastObservedAt (use server 'now' rather than client timestamps)
  2. If caused by clock skew, sync node clocks (NTP) or stamp server-side time
  3. Ignore/skip this error for stale duplicate updates instead of retrying them

Example fix

// before
token.UpdateLastObservedAt(clientRequestTime) // may be older
// after
now := time.Now()
if now.After(token.LastObservedAt) {
    token.UpdateLastObservedAt(now)
}
Defensive patterns

Strategy: try-catch

Validate before calling

if !lastObservedAt.Before(tok.LastObservedAt) {
    _ = tok.UpdateLastObservedAt(lastObservedAt)
}

Try / catch

if err := tok.UpdateLastObservedAt(ts); err != nil {
    if strings.Contains(err.Error(), "before the current last observed at") {
        return nil // stale update, ignore
    }
    return err
}

Prevention

When it happens

Trigger: Calling UpdateLastObservedAt with an out-of-order timestamp, e.g. from replayed events, clock skew between nodes, or processing requests in the wrong order.

Common situations: Distributed workers updating the same token with skewed clocks, or queued/delayed events delivering older observation times.

Related errors


AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28). Data as JSON: /api/errors/19210f2e724c0d9d. Report an issue: GitHub.