{"record":{"id":"95b36582494c90ba","repo":"caddyserver/caddy","slug":"failed-to-parse-root-certificate-v","errorCode":null,"errorMessage":"failed to parse root certificate: %v","messagePattern":"failed to parse root certificate: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/caddypki/command.go","lineNumber":231,"sourceCode":"\t\treturn nil, fmt.Errorf(\"requesting CA info: %v\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\t// Decode the response\n\tcaInfo := new(caInfo)\n\terr = json.NewDecoder(resp.Body).Decode(caInfo)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to decode JSON response: %v\", err)\n\t}\n\n\t// Decode the root cert\n\trootBlock, _ := pem.Decode([]byte(caInfo.RootCert))\n\tif rootBlock == nil {\n\t\treturn nil, fmt.Errorf(\"failed to decode root certificate: %v\", err)\n\t}\n\trootCert, err := x509.ParseCertificate(rootBlock.Bytes)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse root certificate: %v\", err)\n\t}\n\n\treturn rootCert, nil\n}\n","sourceCodeStart":213,"sourceCodeEnd":236,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddypki/command.go#L213-L236","documentation":"Error \"failed to parse root certificate: %v\" thrown in caddyserver/caddy.","triggerScenarios":"Thrown at modules/caddypki/command.go:231 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the root certificate is a valid X.509 certificate; re-fetch it from the CA if corrupted."],"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"}