{"record":{"id":"d284697d074ed901","repo":"XTLS/Xray-core","slug":"unknown-security-c-security","errorCode":null,"errorMessage":"Unknown security \"\" + c.Security + \"\".","messagePattern":"Unknown security \"\" \\+ c\\.Security \\+ \"\"\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"infra/conf/transport_internet.go","lineNumber":116,"sourceCode":"\t\tconfig.SecurityType = tm.Type\n\tcase \"reality\":\n\t\tif config.ProtocolName != \"tcp\" && config.ProtocolName != \"splithttp\" && config.ProtocolName != \"grpc\" {\n\t\t\treturn nil, errors.New(\"REALITY only supports RAW, XHTTP and gRPC for now.\")\n\t\t}\n\t\tif c.REALITYSettings == nil {\n\t\t\treturn nil, errors.New(`REALITY: Empty \"realitySettings\".`)\n\t\t}\n\t\tts, err := c.REALITYSettings.Build()\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"Failed to build REALITY config.\").Base(err)\n\t\t}\n\t\ttm := serial.ToTypedMessage(ts)\n\t\tconfig.SecuritySettings = append(config.SecuritySettings, tm)\n\t\tconfig.SecurityType = tm.Type\n\tcase \"xtls\":\n\t\treturn nil, errors.PrintRemovedFeatureError(`Legacy XTLS`, `xtls-rprx-vision with TLS or REALITY`)\n\tdefault:\n\t\treturn nil, errors.New(`Unknown security \"` + c.Security + `\".`)\n\t}\n\n\tif c.RAWSettings != nil {\n\t\tc.TCPSettings = c.RAWSettings\n\t}\n\tif c.TCPSettings != nil {\n\t\tts, err := c.TCPSettings.Build()\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"Failed to build RAW config.\").Base(err)\n\t\t}\n\t\tconfig.TransportSettings = append(config.TransportSettings, &internet.TransportConfig{\n\t\t\tProtocolName: \"tcp\",\n\t\t\tSettings:     serial.ToTypedMessage(ts),\n\t\t})\n\t}\n\tif c.XHTTPSettings != nil {\n\t\tc.SplitHTTPSettings = c.XHTTPSettings\n\t}","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/infra/conf/transport_internet.go#L98-L134","documentation":"Default-branch error from StreamConfig security building: streamSettings.security is not one of \"\", \"none\", \"tls\", \"reality\", or \"xtls\". Note \"xtls\" is separately rejected as a removed legacy feature, so any other string (including typos and legacy names like \"realitys\") lands here. The invalid value is interpolated into the message.","triggerScenarios":"Setting security to \"ssl\", \"TLS\" (case not normalized), \"auto\", or \"reality+tls\" triggers this at build time.","commonSituations":"Typos; migrating configs from other clients that use different security names; leftover \"xtls\" values that now map to a removal error rather than working.","solutions":["Set security to one of: \"none\", \"tls\", or \"reality\".","For legacy \"xtls\", migrate to \"tls\"/\"reality\" with xtls-rprx-vision flow.","Remove the security field entirely if no security layer is wanted (defaults to none)."],"exampleFix":"// before\n\"security\": \"ssl\"\n// after\n\"security\": \"tls\"","handlingStrategy":"validation","validationCode":"switch strings.ToLower(security) {\ncase \"\", \"none\", \"tls\", \"reality\":\ndefault:\n    return fmt.Errorf(\"unsupported security %q (xtls is removed; use tls or reality)\", security)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Whitelist security values in config tooling.","Replace legacy xtls with tls/reality + xtls-rprx-vision flow.","Normalize case before comparing security strings."],"tags":["go","xray","config","validation","tls"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}