{"record":{"id":"45962af149393247","repo":"kopia/kopia","slug":"unable-to-create-throttler","errorCode":null,"errorMessage":"unable to create throttler","messagePattern":"unable to create throttler","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"repo/open.go","lineNumber":455,"sourceCode":"\n\treturn beforeop.NewWrapper(st, nil, nil, nil, func(_ context.Context, id blob.ID, opts *blob.PutOptions) error {\n\t\tfor _, prefix := range prefixes {\n\t\t\tif strings.HasPrefix(string(id), string(prefix)) {\n\t\t\t\topts.RetentionMode = r.RetentionMode\n\t\t\t\topts.RetentionPeriod = r.RetentionPeriod\n\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t})\n}\n\nfunc addThrottler(st blob.Storage, limits throttling.Limits) (blob.Storage, throttling.SettableThrottler, error) {\n\tthrottler, err := throttling.NewThrottler(limits, throttlingWindow, throttleBucketInitialFill)\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"unable to create throttler\")\n\t}\n\n\treturn throttling.NewWrapper(st, throttler), throttler, nil\n}\n\nfunc upgradeLockMonitor(\n\tfmgr *format.Manager,\n\tupgradeOwnerID string,\n\tst blob.Storage,\n\tnow func() time.Time,\n\tonFatalError func(err error),\n\tignoreMissingRequiredFeatures bool,\n) blob.Storage {\n\tvar (\n\t\tm             sync.RWMutex\n\t\tlastCheckTime time.Time\n\t)\n","sourceCodeStart":437,"sourceCodeEnd":473,"githubUrl":"https://github.com/kopia/kopia/blob/82495e54b584c1ef6073c9e1be048f57f8aef078/repo/open.go#L437-L473","documentation":"addThrottler wraps an error from throttling.NewThrottler, which builds the token-bucket rate limiter applied to blob storage operations. Failure means the throttling configuration (limits) is invalid, so the repository cannot be wrapped in a throttled storage layer and open aborts.","triggerScenarios":"openWithConfig calls addThrottler with throttling.Limits derived from repository/CLI options; NewThrottler returns an error when the limits are invalid (e.g. negative or nonsensical download/upload/uploadUnpacked rates or burst values configured).","commonSituations":"User sets custom throttling limits via kopia configuration (e.g. --max-download-speed, max-upload-speed) with zero/negative/invalid values; corrupted local config file with bad throttling fields.","solutions":["Inspect the wrapped cause; it names the invalid throttling parameter.","Check the throttling limits in your local Kopia configuration (kopia repository status shows them).","Remove or correct invalid values — rates must be positive (or unset/0 for no limit) and burst values sane.","Re-set limits with valid values: kopia repository set-parameters --max-download-speed etc."],"exampleFix":"// before: invalid limit\nlimits := throttling.Limits{DownloadSpeed: -100}\n// after: validate before opening\nif limits.DownloadSpeed < 0 { limits.DownloadSpeed = 0 } // 0 = unlimited\nrep, err := openWithConfig(ctx, st, pass, limits)","handlingStrategy":"validation","validationCode":"// Go: validate throttling limits before open\nfunc validLimits(l throttling.Limits) error {\n    if l.DownloadSpeed < 0 || l.UploadSpeed < 0 || l.UploadSpeedBytesPerSecond < 0 {\n        return errors.New(\"throttle rates must be non-negative\")\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"st, throttler, err := addThrottler(storage, limits)\nif err != nil && strings.Contains(err.Error(), \"unable to create throttler\") {\n    return fmt.Errorf(\"invalid throttling config: %w\", err)\n}","preventionTips":["Validate rate-limit values (positive or zero-for-unlimited) before saving them to config.","Review kopia repository set-parameters values after changing throttling.","Sanitize config files migrated from other tools/versions."],"tags":["kopia","throttling","invalid-config","repository-open"],"backgroundTag":"invalid-config-value","analyzedSha":"82495e54b584c1ef6073c9e1be048f57f8aef078","analyzedAt":"2026-09-07T20:35:21.689Z","contentChangedAt":"2026-09-07T20:35:21.689Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}