{"record":{"id":"4e40315ab887f253","repo":"XTLS/Xray-core","slug":"failed-to-build-raw-config","errorCode":null,"errorMessage":"Failed to build RAW config.","messagePattern":"Failed to build RAW config\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"infra/conf/transport_internet.go","lineNumber":125,"sourceCode":"\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}\n\tif c.SplitHTTPSettings != nil {\n\t\ths, err := c.SplitHTTPSettings.Build()\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"Failed to build XHTTP config.\").Base(err)\n\t\t}\n\t\tconfig.TransportSettings = append(config.TransportSettings, &internet.TransportConfig{\n\t\t\tProtocolName: \"splithttp\",\n\t\t\tSettings:     serial.ToTypedMessage(hs),\n\t\t})","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/infra/conf/transport_internet.go#L107-L143","documentation":"Wrapper thrown when streamSettings contains tcpSettings (or its alias rawSettings) whose Build() fails. The underlying RAW/TCP transport error (e.g. invalid header settings) is chained with .Base(err). Note rawSettings is copied onto tcpSettings before the build, so either key can trigger it.","triggerScenarios":"A tcpSettings/rawSettings block with invalid header type or malformed header request fields triggers this; the detailed cause is in the base error.","commonSituations":"Using the older 'tcpSettings' key on a fork that expects 'rawSettings' with incompatible values; bad header objects copied from old configs.","solutions":["Inspect the base error for the exact RAW-setting field at fault.","Prefer the 'rawSettings' key name (newer) over 'tcpSettings'.","Simplify: remove the header block to test with default RAW settings."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if _, err := streamCfg.Build(); err != nil {\n    if strings.Contains(err.Error(), \"Failed to build RAW config\") {\n        return fmt.Errorf(\"raw/tcp settings invalid: %w\", errors.Unwrap(err))\n    }\n}","preventionTips":["Prefer the rawSettings key; keep tcpSettings only as an alias with identical shape.","Validate header.type against the supported list before build.","Test transports one at a time to isolate the failing settings block."],"tags":["go","xray","config","transport","error-chaining"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}