{"record":{"id":"cb8cf352826f3c93","repo":"caddyserver/caddy","slug":"unrecognized-certificate-key-encoding-format-s","errorCode":null,"errorMessage":"unrecognized certificate/key encoding format: %s","messagePattern":"unrecognized certificate/key encoding format: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/caddytls/fileloader.go","lineNumber":107,"sourceCode":"\t\t\treturn nil, err\n\t\t}\n\n\t\tvar cert tls.Certificate\n\t\tswitch pair.Format {\n\t\tcase \"\":\n\t\t\tfallthrough\n\n\t\tcase \"pem\":\n\t\t\t// if the start of the key file looks like an encrypted private key,\n\t\t\t// reject it with a helpful error message\n\t\t\tif strings.Contains(string(keyData[:40]), \"ENCRYPTED\") {\n\t\t\t\treturn nil, fmt.Errorf(\"encrypted private keys are not supported; please decrypt the key first\")\n\t\t\t}\n\n\t\t\tcert, err = tls.X509KeyPair(certData, keyData)\n\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unrecognized certificate/key encoding format: %s\", pair.Format)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tcerts = append(certs, Certificate{Certificate: cert, Tags: pair.Tags})\n\t}\n\treturn certs, nil\n}\n\n// Interface guard\nvar (\n\t_ CertificateLoader = (FileLoader)(nil)\n\t_ caddy.Provisioner = (FileLoader)(nil)\n)\n","sourceCodeStart":89,"sourceCodeEnd":123,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddytls/fileloader.go#L89-L123","documentation":"Error \"unrecognized certificate/key encoding format: %s\" thrown in caddyserver/caddy.","triggerScenarios":"Thrown at modules/caddytls/fileloader.go:107 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use PEM or DER encoded certificates and keys; the given encoding format is not recognized."],"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-15T22:17:37.221Z"}