chenhg5/cc-connect · error

unknown timezone %q

Error message

unknown timezone %q

What it means

Raised in parseClaudeUsageResetTime when time.LoadLocation fails for a timezone name extracted from a parenthesized suffix of the reset label. The quoted %q is the unrecognized zone name; the system tz database cannot resolve it.

Source

Thrown at agent/claudecode/claude_usage.go:407

				resetAfter = 0
			}
			window.ResetAfterSeconds = resetAfter
			window.ResetAtUnix = resetAt.Unix()
		}
	}

	return window, nil
}

func parseClaudeUsageResetTime(raw string, now time.Time) (time.Time, error) {
	label := strings.TrimSpace(raw)
	loc := now.Location()
	if m := claudeUsageParenTZRe.FindStringSubmatch(label); len(m) == 3 {
		label = strings.TrimSpace(m[1])
		tzName := strings.TrimSpace(m[2])
		tzLoc, err := time.LoadLocation(tzName)
		if err != nil {
			return time.Time{}, fmt.Errorf("unknown timezone %q", tzName)
		}
		loc = tzLoc
	}

	nowInLoc := now.In(loc)
	for _, layout := range []string{"3:04pm", "3pm"} {
		parsed, err := time.ParseInLocation(layout, label, loc)
		if err != nil {
			continue
		}
		resetAt := time.Date(nowInLoc.Year(), nowInLoc.Month(), nowInLoc.Day(), parsed.Hour(), parsed.Minute(), 0, 0, loc)
		if !resetAt.After(nowInLoc) {
			resetAt = resetAt.Add(24 * time.Hour)
		}
		return resetAt, nil
	}

	for _, layout := range []string{"Jan 2, 3:04pm", "Jan 2, 3pm"} {

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Ensure the tzdata package is installed (common in minimal containers)
  2. On Go, import _ 'time/tzdata' or ship zoneinfo so LoadLocation works
  3. Retry after fixing the system timezone database
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at agent/claudecode/claude_usage.go:407 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/935244d917ece6a1. Report an issue: GitHub.