{"record":{"id":"0e7beaf0ca93d7e1","repo":"crowdsecurity/crowdsec","slug":"while-parsing-bouncers-cert-auto-delete-duration","errorCode":null,"errorMessage":"while parsing bouncers cert auto-delete duration: %w","messagePattern":"while parsing bouncers cert auto-delete duration: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/database/flush.go","lineNumber":96,"sourceCode":"\t\tif config.AgentsGC.LoginPassword != nil {\n\t\t\tduration, err := cstime.ParseDurationWithDays(*config.AgentsGC.LoginPassword)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"while parsing agents login/password auto-delete duration: %w\", err)\n\t\t\t}\n\n\t\t\tconfig.AgentsGC.LoginPasswordDuration = &duration\n\t\t}\n\n\t\tif config.AgentsGC.Api != nil {\n\t\t\tc.Log.Warning(\"agents auto-delete for API auth is not supported (use cert or login_password)\")\n\t\t}\n\t}\n\n\tif config.BouncersGC != nil {\n\t\tif config.BouncersGC.Cert != nil {\n\t\t\tduration, err := cstime.ParseDurationWithDays(*config.BouncersGC.Cert)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"while parsing bouncers cert auto-delete duration: %w\", err)\n\t\t\t}\n\n\t\t\tconfig.BouncersGC.CertDuration = &duration\n\t\t}\n\n\t\tif config.BouncersGC.Api != nil {\n\t\t\tduration, err := cstime.ParseDurationWithDays(*config.BouncersGC.Api)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"while parsing bouncers api auto-delete duration: %w\", err)\n\t\t\t}\n\n\t\t\tconfig.BouncersGC.ApiDuration = &duration\n\t\t}\n\n\t\tif config.BouncersGC.LoginPassword != nil {\n\t\t\tc.Log.Warning(\"bouncers auto-delete for login/password auth is not supported (use cert or api)\")\n\t\t}\n\t}","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/database/flush.go#L78-L114","documentation":"StartFlushScheduler parses bouncers_gc.cert with cstime.ParseDurationWithDays to know when to delete stale bouncer certificate registrations. A parse failure produces this wrapped error and aborts startup.","triggerScenarios":"config.BouncersGC.Cert is set to a string ParseDurationWithDays rejects: missing unit, unsupported unit ('mo', 'y', 'w'), or invalid numeric format.","commonSituations":"Misconfigured api.server.gc.bouncers_gc.cert in config.yaml, e.g. cert: 6months or cert: 30 without a unit; copy-paste from non-crowdsec docs.","solutions":["Set a valid value such as cert: 30d or cert: 720h in config.yaml under bouncers_gc.","Convert unsupported units to days or Go durations before entering them.","Remove the cert key to skip bouncer cert GC.","Run a config validation/startup dry run to confirm the value parses before deploying to production."],"exampleFix":"// before\nbouncers_gc:\n  cert: 6months\n\n// after\nbouncers_gc:\n  cert: 180d","handlingStrategy":"validation","validationCode":"if cfg.BouncersGC != nil && cfg.BouncersGC.Cert != \"\" {\n    if _, err := cstime.ParseDurationWithDays(cfg.BouncersGC.Cert); err != nil {\n        return fmt.Errorf(\"bouncers_gc.cert: %w\", err)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n    if strings.Contains(err.Error(), \"bouncers cert\") {\n        // reject/fix the bouncers_gc.cert value\n    }\n    return err\n}","preventionTips":["Use '30d' or '720h' style values; avoid '6months' or '1y'.","Watch the warning logs for unsupported GC keys (e.g. bouncers login_password) while editing the config.","Test config changes on a staging instance before production."],"tags":["go","config","duration","crowdsec"],"backgroundTag":"invalid-duration-format","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}