cilium/cilium · error

failed to parse the since time: %w

Error message

failed to parse the since time: %w

What it means

The --since flag value is parsed with hubtime.FromString, which accepts relative durations (e.g. 5m) and absolute timestamps. If parsing fails, getFlowsRequest wraps the underlying error with this message, aborting request construction.

Source

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

	if first && last {
		return nil, fmt.Errorf("cannot set both --first and --last")
	}
	if first && selectorOpts.all {
		return nil, fmt.Errorf("cannot set both --first and --all")
	}
	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)

View on GitHub (pinned to ac7b90affa)

Solutions

  1. Use a valid relative duration like --since 5m, 1h, or 24h
  2. Use an RFC3339 absolute timestamp, e.g. --since 2024-01-01T00:00:00Z
  3. Run `hubble observe --help` / check hubtime.FromString docs for accepted formats
  4. Quote the value in shell to avoid mangling (e.g. --since '5m')

Example fix

// before
hubble observe --since 5 mins ago
// after
hubble observe --since 5m
Defensive patterns

Strategy: validation

Validate before calling

func validSince(s string) error {
    if s == "" { return nil }
    if _, err := hubtime.FromString(s); err != nil {
        return fmt.Errorf("--since %q unparseable: %w", s, err)
    }
    return nil
}

Try / catch

req, err := getFlowsRequest(ofilter, allow, deny)
if err != nil && strings.HasPrefix(err.Error(), "failed to parse the since") {
    return fmt.Errorf("check --since format (e.g. 5m or RFC3339): %w", err)
}

Prevention

When it happens

Trigger: Running `hubble observe --since blah`, `--since 2024-13-01` (invalid date), or an unparseable relative duration like `--since 5mins`.

Common situations: Shell quoting stripping units or adding stray characters; assuming arbitrary date formats are accepted (e.g. US-format MM/DD/YYYY); timezone-suffixed strings not supported by the parser.

Understand the failure class

Related errors


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