{"record":{"id":"24ee040c48b475b8","repo":"chenhg5/cc-connect","slug":"max-webhook-resubscribe-interval-w","errorCode":null,"errorMessage":"max: webhook_resubscribe_interval: %w","messagePattern":"max: webhook_resubscribe_interval: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/max/max.go","lineNumber":133,"sourceCode":"\n\twebhookURL, _ := opts[\"webhook_url\"].(string)\n\twebhookListen, _ := opts[\"webhook_listen\"].(string)\n\twebhookPath, _ := opts[\"webhook_path\"].(string)\n\twebhookSecret, _ := opts[\"webhook_secret\"].(string)\n\tif webhookURL != \"\" && webhookListen == \"\" {\n\t\twebhookListen = \":8080\"\n\t}\n\tif webhookPath == \"\" {\n\t\twebhookPath = \"/webhook\"\n\t} else if !strings.HasPrefix(webhookPath, \"/\") {\n\t\twebhookPath = \"/\" + webhookPath\n\t}\n\n\tresubscribeInterval := 5 * time.Minute\n\tif raw, ok := opts[\"webhook_resubscribe_interval\"].(string); ok && raw != \"\" {\n\t\td, err := time.ParseDuration(raw)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"max: webhook_resubscribe_interval: %w\", err)\n\t\t}\n\t\tresubscribeInterval = d\n\t}\n\n\treturn &Platform{\n\t\ttoken:               token,\n\t\tapiBase:             apiBase,\n\t\tallowFrom:           allowFrom,\n\t\twebhookURL:          webhookURL,\n\t\twebhookListen:       webhookListen,\n\t\twebhookPath:         webhookPath,\n\t\twebhookSecret:       webhookSecret,\n\t\tresubscribeInterval: resubscribeInterval,\n\t\tclient:              &http.Client{Timeout: httpTimeout},\n\t\tuploadClient:        &http.Client{Timeout: attachmentUploadTO},\n\t}, nil\n}\n","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/max/max.go#L115-L151","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nopts[\"webhook_resubscribe_interval\"] = \"300\"\n// after\nopts[\"webhook_resubscribe_interval\"] = \"300s\"","handlingStrategy":"validation","validationCode":"if v, ok := opts[\"webhook_resubscribe_interval\"].(string); ok && v != \"\" {\n    if _, err := time.ParseDuration(v); err != nil {\n        return fmt.Errorf(\"invalid webhook_resubscribe_interval %q: %w\", v, err)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["go","config","duration-parsing"],"backgroundTag":"invalid-duration-format","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}