{"record":{"id":"e01d9eff3aaa36e9","repo":"caddyserver/caddy","slug":"failed-to-decode-root-certificate-v","errorCode":null,"errorMessage":"failed to decode root certificate: %v","messagePattern":"failed to decode root certificate: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/caddypki/command.go","lineNumber":227,"sourceCode":"\n\t// Make the request to fetch the CA info\n\tresp, err := caddycmd.AdminAPIRequest(adminAddr, http.MethodGet, uri, make(http.Header), nil)\n\tif err != nil {\n\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":209,"sourceCodeEnd":236,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddypki/command.go#L209-L236","documentation":"Error \"failed to decode root certificate: %v\" thrown in caddyserver/caddy.","triggerScenarios":"Thrown at modules/caddypki/command.go:227 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the CA certificate data returned is valid PEM; check the server and CA configuration."],"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"}