cilium/cilium · error

failed to convert `since` timestamp to proto: %w

Error message

failed to convert `since` timestamp to proto: %w

What it means

After hubtime parses --since, the resulting time is converted to a protobuf timestamppb.Timestamp and validated with CheckValid(). If the parsed time is out of the protobuf-valid range (e.g. year far beyond 9999 or negative overflow), this error wraps the proto validation failure.

Source

Thrown at hubble/cmd/observe/flows.go:789

	}
	if first && selectorOpts.follow {
		return nil, fmt.Errorf("cannot set both --first and --follow")
	}
	if last && selectorOpts.all {
		return nil, fmt.Errorf("cannot set both --last and --all")
	}

	// convert selectorOpts.since into a param for GetFlows
	var since, until *timestamppb.Timestamp
	if selectorOpts.since != "" {
		st, err := hubtime.FromString(selectorOpts.since)
		if err != nil {
			return nil, fmt.Errorf("failed to parse the since time: %w", err)
		}

		since = timestamppb.New(st)
		if err := since.CheckValid(); err != nil {
			return nil, fmt.Errorf("failed to convert `since` timestamp to proto: %w", err)
		}
	}
	// Set the until field if --until option is specified and --follow
	// is not specified. If --since is specified but --until is not, the server sets the
	// --until option to the current timestamp.
	if selectorOpts.until != "" && !selectorOpts.follow {
		ut, err := hubtime.FromString(selectorOpts.until)
		if err != nil {
			return nil, fmt.Errorf("failed to parse the until time: %w", err)
		}
		until = timestamppb.New(ut)
		if err := until.CheckValid(); err != nil {
			return nil, fmt.Errorf("failed to convert `until` timestamp to proto: %w", err)
		}
	}

	if since == nil && until == nil && !first {
		switch {

View on GitHub (pinned to ac7b90affa)

Solutions

  1. Use a sane, in-range timestamp (between year 1 and 9999, RFC3339 or a modest relative duration)
  2. Sanitize user/supplied durations before passing to --since (cap max lookback)
  3. If you need times outside protobuf range, filter client-side instead of via --since

Example fix

// before
hubble observe --since 99999999h
// after
hubble observe --since 999999h
Defensive patterns

Strategy: validation

Validate before calling

t, err := hubtime.FromString(since)
if err != nil { return err }
if t.Year() < 1 || t.Year() > 9999 {
    return fmt.Errorf("--since resolves to out-of-range year %d", t.Year())
}

Try / catch

req, err := getFlowsRequest(ofilter, allow, deny)
if err != nil {
    var rangeErr error
    if strings.Contains(err.Error(), "timestamp to proto") {
        return fmt.Errorf("--since out of protobuf Timestamp range: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Passing --since with an extreme value such as `--since 9999999999h` whose resolved time exceeds protobuf Timestamp bounds (year 1..9999), or a system clock/parse edge producing an out-of-range time.Time.

Common situations: Huge relative durations meant as seconds instead of hours; script-computed timestamps in ms mistakenly interpreted as ns; malicious or fuzzed input.

Related errors


AI-assisted analysis of cilium/cilium@ac7b90affa (2026-08-31). Data as JSON: /api/errors/ba93f6ea9c49da8a. Report an issue: GitHub.