{"record":{"id":"c0bfc5eba179ed34","repo":"XTLS/Xray-core","slug":"version-2","errorCode":null,"errorMessage":"version != 2","messagePattern":"version != 2","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"infra/conf/hysteria.go","lineNumber":21,"sourceCode":"import (\n\t\"github.com/xtls/xray-core/common/errors\"\n\t\"github.com/xtls/xray-core/common/protocol\"\n\t\"github.com/xtls/xray-core/common/serial\"\n\t\"github.com/xtls/xray-core/common/task\"\n\t\"github.com/xtls/xray-core/proxy/hysteria\"\n\t\"github.com/xtls/xray-core/proxy/hysteria/account\"\n\t\"google.golang.org/protobuf/proto\"\n)\n\ntype HysteriaClientConfig struct {\n\tVersion int32    `json:\"version\"`\n\tAddress *Address `json:\"address\"`\n\tPort    uint16   `json:\"port\"`\n}\n\nfunc (c *HysteriaClientConfig) Build() (proto.Message, error) {\n\tif c.Version != 2 {\n\t\treturn nil, errors.New(\"version != 2\")\n\t}\n\n\tconfig := &hysteria.ClientConfig{}\n\tconfig.Server = &protocol.ServerEndpoint{\n\t\tAddress: c.Address.Build(),\n\t\tPort:    uint32(c.Port),\n\t}\n\n\treturn config, nil\n}\n\ntype HysteriaUserConfig struct {\n\tAuth  string `json:\"auth\"`\n\tLevel uint32 `json:\"level\"`\n\tEmail string `json:\"email\"`\n}\n\ntype HysteriaServerConfig struct {","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/infra/conf/hysteria.go#L3-L39","documentation":"Thrown by HysteriaClientConfig.Build when the hysteria outbound's version field is not exactly 2. Xray's hysteria implementation only supports Hysteria2; the version field is a hard gate on the client side. Both an omitted version (zero default) and version: 1 fail here.","triggerScenarios":"Adding a hysteria outbound without \"version\": 2 in settings, or explicitly setting version to 1 or 3.","commonSituations":"Copying a Hysteria1 config from another client (original hysteria uses different fields); assuming version is optional with a sane default; forgetting the field when hand-writing outbounds.","solutions":["Set \"version\": 2 in the hysteria outbound settings","If you actually have a Hysteria1 server, migrate the server to Hysteria2 or use a client that supports v1"],"exampleFix":"// before\n{ \"protocol\": \"hysteria\", \"settings\": { \"address\": \"h.example.com\", \"port\": 443 } }\n// after\n{ \"protocol\": \"hysteria\", \"settings\": { \"version\": 2, \"address\": \"h.example.com\", \"port\": 443 } }","handlingStrategy":"validation","validationCode":"if hysteriaSettings.Version != 2 {\n\treturn errors.New(\"hysteria outbound requires version: 2\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin \"version\": 2 in every hysteria outbound template","Remember Xray supports Hysteria2 only; migrate v1 servers"],"tags":["xray","config","hysteria","outbound","version","validation"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}