{"record":{"id":"de33ed0f731b3d90","repo":"benbjohnson/litestream","slug":"invalid-sync-interval-w","errorCode":null,"errorMessage":"invalid sync_interval: %w","messagePattern":"invalid sync_interval: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vfs_config.go","lineNumber":69,"sourceCode":"}\n\nfunc DeleteVFSConfig(dbName string) {\n\tvfsConfigsMu.Lock()\n\tdefer vfsConfigsMu.Unlock()\n\tdelete(vfsConfigs, dbName)\n}\n\nfunc (cfg *VFSConfig) Set(key, value string) error {\n\tswitch key {\n\tcase \"replica_url\":\n\t\tcfg.ReplicaURL = value\n\tcase \"write_enabled\":\n\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 {","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/vfs_config.go#L51-L87","documentation":"VFSConfig.Set validates URI/config parameters. The sync_interval value must parse as a Go time.ParseDuration string (e.g. \"10s\", \"1m\"). This error wraps the underlying parse failure when the value is not a valid duration.","triggerScenarios":"Calling Set(\"sync_interval\", <value>) — directly or via ParseVFSURIConfig from a VFS URI like litestream://...?sync_interval=xyz — where the value fails time.ParseDuration (e.g. \"10\", \"abc\", \"10sec\").","commonSituations":"Writing sync_interval=10 without a unit in the VFS URI or config file; using unit spellings Go does not accept (sec, mins); copy/paste from non-Go documentation.","solutions":["Use a valid Go duration string with a unit suffix, e.g. sync_interval=10s","Fix the URI/config value: examples 1s, 500ms, 1m30s","If building values programmatically, use time.Duration.String() to render the value"],"exampleFix":"// before\nlitestream://file:///db?sync_interval=10\n// after\nlitestream://file:///db?sync_interval=10s","handlingStrategy":"validation","validationCode":"d, err := time.ParseDuration(v)\nif err != nil { return fmt.Errorf(\"sync_interval must be a Go duration like 10s: %w\", err) }\n_ = d","typeGuard":null,"tryCatchPattern":"if err := cfg.Set(\"sync_interval\", v); err != nil {\n    if strings.Contains(err.Error(), \"invalid sync_interval\") {\n        // surface the wrapped time.ParseDuration message to the operator\n    }\n}","preventionTips":["Always include a unit suffix in duration config values (s, m, h)","Test URI config parsing in CI before deploying","Generate duration strings via time.Duration.String()"],"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-14T00:17:10.932Z"}