{"record":{"id":"20f8cb971e7b8603","repo":"benbjohnson/litestream","slug":"invalid-poll-interval-w","errorCode":null,"errorMessage":"invalid poll_interval: %w","messagePattern":"invalid poll_interval: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vfs_config.go","lineNumber":82,"sourceCode":"\t\tb := strings.ToLower(value) == \"true\" || value == \"1\"\n\t\tcfg.WriteEnabled = &b\n\tcase \"sync_interval\":\n\t\td, err := time.ParseDuration(value)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid sync_interval: %w\", err)\n\t\t}\n\t\tcfg.SyncInterval = &d\n\tcase \"buffer_path\":\n\t\tcfg.BufferPath = value\n\tcase \"hydration_enabled\":\n\t\tb := strings.ToLower(value) == \"true\" || value == \"1\"\n\t\tcfg.HydrationEnabled = &b\n\tcase \"hydration_path\":\n\t\tcfg.HydrationPath = value\n\tcase \"poll_interval\":\n\t\td, err := time.ParseDuration(value)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid poll_interval: %w\", err)\n\t\t}\n\t\tcfg.PollInterval = &d\n\tcase \"cache_size\":\n\t\tn, err := strconv.Atoi(value)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid cache_size: %w\", err)\n\t\t}\n\t\tcfg.CacheSize = &n\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown config key: %s\", key)\n\t}\n\treturn nil\n}\n\nfunc ParseVFSURIConfig(uriParameters map[string]string) (*VFSConfig, error) {\n\tif len(uriParameters) == 0 {\n\t\treturn nil, nil\n\t}","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/vfs_config.go#L64-L100","documentation":"Validation in the VFS URI config Set method: the poll_interval parameter is not a valid Go duration string. Fires when parsing a vfs:// URI whose poll_interval query value cannot be parsed by time.ParseDuration (e.g. 'poll_interval=fast').","triggerScenarios":"Calling Set(\"poll_interval\", <value>) — directly or via ParseVFSURIConfig from URI query parameters — where the value fails time.ParseDuration (e.g. \"5\", \"every minute\", \"1h30\").","commonSituations":"poll_interval=5 missing the unit in the connection URI; invalid unit like \"5secs\"; environment-specific config templating producing empty or malformed values.","solutions":["Supply a valid duration with unit, e.g. poll_interval=5s","Correct the unit spelling to Go's ns/us/µs/ms/s/m/h set","Render values with time.Duration.String() when generating config programmatically"],"exampleFix":"// before\nlitestream://file:///db?poll_interval=5\n// after\nlitestream://file:///db?poll_interval=5s","handlingStrategy":"validation","validationCode":"d, err := time.ParseDuration(v)\nif err != nil { return fmt.Errorf(\"poll_interval must be a Go duration like 5s: %w\", err) }\n_ = d","typeGuard":null,"tryCatchPattern":"if err := cfg.Set(\"poll_interval\", v); err != nil {\n    if strings.Contains(err.Error(), \"invalid poll_interval\") {\n        // log the wrapped parse error and correct the value\n    }\n}","preventionTips":["Validate poll_interval values with time.ParseDuration before building the URI","Use unit-suffixed values only (ms, s, m, h)","Cover config parsing with unit tests using real URI strings"],"tags":["go","config","duration","validation"],"backgroundTag":"invalid-duration-format","analyzedSha":"4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3","analyzedAt":"2026-09-06T18:29:25.564Z","contentChangedAt":"2026-09-06T18:29:25.564Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}