chenhg5/cc-connect · error
max: webhook_resubscribe_interval: %w
Error message
max: webhook_resubscribe_interval: %w
What it means
New parses the optional "webhook_resubscribe_interval" option as a Go duration string (time.ParseDuration). If the value is a non-empty string that is not a valid duration (e.g. "300", "5mn", "ten minutes"), New returns this wrapped error and the platform is not created.
Source
Thrown at platform/max/max.go:133
webhookURL, _ := opts["webhook_url"].(string)
webhookListen, _ := opts["webhook_listen"].(string)
webhookPath, _ := opts["webhook_path"].(string)
webhookSecret, _ := opts["webhook_secret"].(string)
if webhookURL != "" && webhookListen == "" {
webhookListen = ":8080"
}
if webhookPath == "" {
webhookPath = "/webhook"
} else if !strings.HasPrefix(webhookPath, "/") {
webhookPath = "/" + webhookPath
}
resubscribeInterval := 5 * time.Minute
if raw, ok := opts["webhook_resubscribe_interval"].(string); ok && raw != "" {
d, err := time.ParseDuration(raw)
if err != nil {
return nil, fmt.Errorf("max: webhook_resubscribe_interval: %w", err)
}
resubscribeInterval = d
}
return &Platform{
token: token,
apiBase: apiBase,
allowFrom: allowFrom,
webhookURL: webhookURL,
webhookListen: webhookListen,
webhookPath: webhookPath,
webhookSecret: webhookSecret,
resubscribeInterval: resubscribeInterval,
client: &http.Client{Timeout: httpTimeout},
uploadClient: &http.Client{Timeout: attachmentUploadTO},
}, nil
}
View on GitHub (pinned to 4000b2338a)
Solutions
- Fix the option value to a valid Go duration string with a unit suffix, e.g. "5m", "300s", "1h".
- Remove the "webhook_resubscribe_interval" option entirely to use the default 5-minute interval.
- Validate the duration in your config loader before constructing the platform.
Example fix
// before opts["webhook_resubscribe_interval"] = "300" // after opts["webhook_resubscribe_interval"] = "300s"
Defensive patterns
Strategy: validation
Validate before calling
if v, ok := opts["webhook_resubscribe_interval"].(string); ok && v != "" {
if _, err := time.ParseDuration(v); err != nil {
return fmt.Errorf("invalid webhook_resubscribe_interval %q: %w", v, err)
}
} Prevention
- Always include duration units ("5m", "30s") in config values
- Validate all duration options with time.ParseDuration at config-load time
- Omit the option to rely on the library default
When it happens
Trigger: Passing opts["webhook_resubscribe_interval"] set to a string like "5" (missing unit), "5m30" (malformed), or any invalid duration string to the max platform constructor New.
Common situations: Config mistakes: writing "300" instead of "300s", typos like "30mintues", or values read from config.toml/env that were not validated before being placed into the options map.
Understand the failure class
Background: "invalid duration" / "failed to parse duration": why your timeout, interval, or TTL string is rejected and which formats each library accepts — this error's family across 32 libraries.
Related errors
- parse existing Agy hooks %s: %w
- marshal Agy hooks overlay: %w
- tmux: 'session' option is required (name of the tmux session
- tmux: session %q does not exist and auto_create is disabled
- tmux: create session %q: %w
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/24ee040c48b475b8.
Report an issue: GitHub.