{"record":{"id":"9cade39e62c00c98","repo":"caddyserver/caddy","slug":"rotating-keys-v","errorCode":null,"errorMessage":"rotating keys: %v","messagePattern":"rotating keys: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/caddytls/distributedstek/distributedstek.go","lineNumber":174,"sourceCode":"\t//nolint:errcheck\n\tdefer s.storage.Unlock(s.ctx, stekLockName)\n\n\t// load the current STEKs from storage\n\tdstek, err := s.loadSTEK()\n\tif errors.Is(err, fs.ErrNotExist) {\n\t\t// if there is none, then make some right away\n\t\tdstek, err = s.rotateKeys(dstek)\n\t\tif err != nil {\n\t\t\treturn dstek, fmt.Errorf(\"creating new STEK: %v\", err)\n\t\t}\n\t} else if err != nil {\n\t\t// some other error, that's a problem\n\t\treturn dstek, fmt.Errorf(\"loading STEK: %v\", err)\n\t} else if time.Now().After(dstek.NextRotation) {\n\t\t// if current STEKs are outdated, rotate them\n\t\tdstek, err = s.rotateKeys(dstek)\n\t\tif err != nil {\n\t\t\treturn dstek, fmt.Errorf(\"rotating keys: %v\", err)\n\t\t}\n\t}\n\n\treturn dstek, nil\n}\n\n// rotateKeys rotates the keys of oldSTEK and returns the new distributedSTEK\n// with updated keys and timestamps. It stores the returned STEK in storage,\n// so this function must only be called in a storage-provided lock.\nfunc (s *Provider) rotateKeys(oldSTEK distributedSTEK) (distributedSTEK, error) {\n\tvar newSTEK distributedSTEK\n\tvar err error\n\n\tnewSTEK.Keys, err = s.stekConfig.RotateSTEKs(oldSTEK.Keys)\n\tif err != nil {\n\t\treturn newSTEK, err\n\t}\n","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddytls/distributedstek/distributedstek.go#L156-L192","documentation":"Error \"rotating keys: %v\" thrown in caddyserver/caddy.","triggerScenarios":"Thrown at modules/caddytls/distributedstek/distributedstek.go:174 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped error and storage backend health; key rotation failed during a STEK operation."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}