{"record":{"id":"3a816d98271ed0a3","repo":"gastownhall/beads","slug":"externaldoltconfig-keepaliveperiod-s-is-negative","errorCode":null,"errorMessage":"ExternalDoltConfig: KeepAlivePeriod %s is negative","messagePattern":"ExternalDoltConfig: KeepAlivePeriod (.+?) is negative","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/configfile/external_dolt_config.go","lineNumber":98,"sourceCode":"\tif !c.TLSRequired {\n\t\tswitch {\n\t\tcase c.TLSCACert != \"\":\n\t\t\treturn errors.New(\"ExternalDoltConfig: TLSCACert set without TLSRequired\")\n\t\tcase c.TLSCert != \"\" || c.TLSKey != \"\":\n\t\t\treturn errors.New(\"ExternalDoltConfig: TLSCert/TLSKey set without TLSRequired\")\n\t\tcase c.TLSServerName != \"\":\n\t\t\treturn errors.New(\"ExternalDoltConfig: TLSServerName set without TLSRequired\")\n\t\tcase c.TLSSkipVerify:\n\t\t\treturn errors.New(\"ExternalDoltConfig: TLSSkipVerify set without TLSRequired\")\n\t\t}\n\t}\n\n\tif c.TLSRequired && hasSocket && c.TLSServerName == \"\" && !c.TLSSkipVerify {\n\t\treturn errors.New(\"ExternalDoltConfig: TLSRequired over Socket needs TLSServerName or TLSSkipVerify\")\n\t}\n\n\tif c.KeepAlivePeriod < 0 {\n\t\treturn fmt.Errorf(\"ExternalDoltConfig: KeepAlivePeriod %s is negative\", c.KeepAlivePeriod)\n\t}\n\n\treturn nil\n}\n\nfunc (c ExternalDoltConfig) TLSClientConfig() (*tls.Config, error) {\n\tif !c.TLSRequired {\n\t\treturn nil, nil\n\t}\n\n\tcfg := &tls.Config{MinVersion: tls.VersionTLS12}\n\n\tif c.TLSSkipVerify {\n\t\tcfg.InsecureSkipVerify = true //nolint:gosec // G402: opt-in insecure transport via the TLSSkipVerify testing flag\n\t} else {\n\t\tname := c.TLSServerName\n\t\tif name == \"\" {\n\t\t\tname = c.Host","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/configfile/external_dolt_config.go#L80-L116","documentation":"ExternalDoltConfig.Validate rejects a negative KeepAlivePeriod. The value is parsed from a Go time.Duration and is used to configure TCP keep-alives on the connection; a negative duration is meaningless and would cause errors or misbehavior when dialing. The valid range is 0 (disabled/default) or a positive duration.","triggerScenarios":"Calling Validate (via NewExternalDoltServer, NewExternalDoltServerUOWProvider, or buildProxiedServerClientInfo) with KeepAlivePeriod set to a negative duration such as \"-5s\", \"-1m\", or a numeric field that was negated.","commonSituations":"Typo of a leading \"-\" in a config file; parsing a duration from a signed integer user input; copy-paste of a value with a stray minus sign.","solutions":["Change KeepAlivePeriod to a positive duration, e.g. \"30s\".","Set KeepAlivePeriod to 0 to disable explicit keep-alive configuration.","If the value comes from a flag/env, clamp negatives to 0 before constructing the config."],"exampleFix":"// before\nkeepAlivePeriod: \"-30s\"\n// after\nkeepAlivePeriod: \"30s\"","handlingStrategy":"validation","validationCode":"func validKeepAlive(cfg configfile.ExternalDoltConfig) error {\n    if cfg.KeepAlivePeriod < 0 {\n        return fmt.Errorf(\"KeepAlivePeriod must be >= 0, got %s\", cfg.KeepAlivePeriod)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use time.ParseDuration output directly, never manual strings","Sanitize user/env-supplied durations: if d < 0 { d = 0 }","Use 0 explicitly when you mean \"use driver default\""],"tags":["config","validation","duration","tcp"],"backgroundTag":"invalid-config-value","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}