{"record":{"id":"063d07b6e110750d","repo":"nats-io/nats-server","slug":"unrecognized-curve-preference-s","errorCode":null,"errorMessage":"unrecognized curve preference %s","messagePattern":"unrecognized curve preference (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/opts.go","lineNumber":5101,"sourceCode":"\t\tfmt.Printf(\"%s\\n\", certstore.Usage)\n\t}\n\tfmt.Printf(\"%s\", certidp.OCSPPeerUsage)\n\tfmt.Printf(\"%s\", OCSPResponseCacheUsage)\n\tos.Exit(0)\n}\n\nfunc parseCipher(cipherName string) (*tls.CipherSuite, error) {\n\tcipher, exists := cipherMap[cipherName]\n\tif !exists {\n\t\treturn nil, fmt.Errorf(\"unrecognized cipher %s\", cipherName)\n\t}\n\treturn cipher, nil\n}\n\nfunc parseCurvePreferences(curveName string) (tls.CurveID, error) {\n\tcurve, exists := curvePreferenceMap[curveName]\n\tif !exists {\n\t\treturn 0, fmt.Errorf(\"unrecognized curve preference %s\", curveName)\n\t}\n\treturn curve, nil\n}\n\nfunc parseTLSVersion(v any) (uint16, error) {\n\tvar tlsVersionNumber uint16\n\tswitch v := v.(type) {\n\tcase string:\n\t\tn, err := tlsVersionFromString(v)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\ttlsVersionNumber = n\n\tdefault:\n\t\treturn 0, fmt.Errorf(\"'min_version' wrong type: %v\", v)\n\t}\n\tif tlsVersionNumber < tls.VersionTLS12 {\n\t\treturn 0, fmt.Errorf(\"unsupported TLS version: %s\", tls.VersionName(tlsVersionNumber))","sourceCodeStart":5083,"sourceCodeEnd":5119,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/opts.go#L5083-L5119","documentation":"parseCurvePreferences looks up the elliptic-curve name in curvePreferenceMap and returns this error when the name is unknown. The server cannot map the given string to a tls.CurveID for TLS ECDHE curve preferences.","triggerScenarios":"Providing an unrecognized curve name in TLS curve preference options (e.g. 'curve_preferences: [\"P256X\"]' or calling parseCurvePreferences('secp256r1')).","commonSituations":"Using SECG/ECDSA names like 'secp256r1' instead of the expected Go-style names ('CurveP256', 'X25519'); typos in config.","solutions":["Use a recognized name from curvePreferenceMap, e.g. 'CurveP256', 'CurveP384', 'CurveP521', 'X25519'","Inspect curvePreferenceMap in server/opts.go for the accepted set","Fix the config value spelling/casing"],"exampleFix":"// before\ncurve_preferences: [\"secp256r1\"]\n// after\ncurve_preferences: [\"CurveP256\"]","handlingStrategy":"validation","validationCode":"var validCurves = map[string]bool{\"CurveP256\": true, \"CurveP384\": true, \"CurveP521\": true, \"X25519\": true}\nif !validCurves[curveName] { return fmt.Errorf(\"unknown curve %s\", curveName) }","typeGuard":null,"tryCatchPattern":"if err := validateCurves(cfg.CurvePreferences); err != nil { log.Fatalf(\"curve config invalid: %v\", err) }","preventionTips":["Use Go TLS curve names, not SECG names","Check the server's curvePreferenceMap for accepted values","Lint config files against the server schema"],"tags":["tls","config-validation","elliptic-curve"],"backgroundTag":"unrecognized-tls-curve","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}