{"record":{"id":"b8d8352cebf1258b","repo":"XTLS/Xray-core","slug":"failed-to-build-mkcp-config","errorCode":null,"errorMessage":"Failed to build mKCP config.","messagePattern":"Failed to build mKCP config\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"infra/conf/transport_internet.go","lineNumber":148,"sourceCode":"\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})\n\t}\n\tif c.KCPSettings != nil {\n\t\tts, err := c.KCPSettings.Build()\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"Failed to build mKCP config.\").Base(err)\n\t\t}\n\t\tconfig.TransportSettings = append(config.TransportSettings, &internet.TransportConfig{\n\t\t\tProtocolName: \"mkcp\",\n\t\t\tSettings:     serial.ToTypedMessage(ts),\n\t\t})\n\t}\n\tif c.GRPCSettings != nil {\n\t\tgs, err := c.GRPCSettings.Build()\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"Failed to build gRPC config.\").Base(err)\n\t\t}\n\t\tconfig.TransportSettings = append(config.TransportSettings, &internet.TransportConfig{\n\t\t\tProtocolName: \"grpc\",\n\t\t\tSettings:     serial.ToTypedMessage(gs),\n\t\t})\n\t}\n\tif c.WSSettings != nil {\n\t\tts, err := c.WSSettings.Build()","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/infra/conf/transport_internet.go#L130-L166","documentation":"Wrapper thrown when streamSettings contains kcpSettings (mKCP transport) whose Build() fails. The concrete cause — invalid header type, bad seed, or malformed obfuscation parameters — is attached with .Base(err) and should be inspected rather than this generic message.","triggerScenarios":"A kcpSettings block with an unknown 'header.type', an invalid 'seed' for sreno header, or non-numeric mtu/tti values.","commonSituations":"Old mKCP configs using header types removed in this fork; seeds containing characters outside the expected alphabet.","solutions":["Read the base error to find the failing mKCP field.","Set header.type to \"none\" and re-add obfuscation step by step.","Regenerate or simplify the seed value."],"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 mKCP config\") {\n        return fmt.Errorf(\"mkcp settings invalid: %w\", errors.Unwrap(err))\n    }\n}","preventionTips":["Whitelist mKCP header.type values in generators.","Regenerate seeds with the documented alphabet.","Keep mtu/tti/uc values within documented ranges."],"tags":["go","xray","config","mkcp","transport","error-chaining"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}