{"record":{"id":"918ced19d284e6b0","repo":"XTLS/Xray-core","slug":"version-2-918ced","errorCode":null,"errorMessage":"version != 2","messagePattern":"version != 2","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"infra/conf/transport_method.go","lineNumber":776,"sourceCode":"\tStatusCode int32             `json:\"statusCode\"`\n}\n\ntype HysteriaConfig struct {\n\tVersion int32  `json:\"version\"`\n\tAuth    string `json:\"auth\"`\n\n\tCongestion *string    `json:\"congestion\"`\n\tUp         *Bandwidth `json:\"up\"`\n\tDown       *Bandwidth `json:\"down\"`\n\tUdpHop     *UdpHop    `json:\"udphop\"`\n\n\tUdpIdleTimeout int64      `json:\"udpIdleTimeout\"`\n\tMasquerade     Masquerade `json:\"masquerade\"`\n}\n\nfunc (c *HysteriaConfig) Build() (proto.Message, error) {\n\tif c.Version != 2 {\n\t\treturn nil, errors.New(\"version != 2\")\n\t}\n\n\tif c.Congestion != nil || c.Up != nil || c.Down != nil || c.UdpHop != nil {\n\t\terrors.LogWarning(context.Background(), \"congestion & up & down & udphop move to finalmask/quicParams\")\n\t}\n\n\tif c.UdpIdleTimeout != 0 && (c.UdpIdleTimeout < 2 || c.UdpIdleTimeout > 600) {\n\t\treturn nil, errors.New(\"UdpIdleTimeout must be between 2 and 600\")\n\t}\n\n\tconfig := &hysteria.Config{}\n\tconfig.Auth = c.Auth\n\tconfig.UdpIdleTimeout = c.UdpIdleTimeout\n\tconfig.MasqType = c.Masquerade.Type\n\tconfig.MasqFile = c.Masquerade.Dir\n\tconfig.MasqUrl = c.Masquerade.Url\n\tconfig.MasqUrlRewriteHost = c.Masquerade.RewriteHost\n\tconfig.MasqUrlInsecure = c.Masquerade.Insecure","sourceCodeStart":758,"sourceCodeEnd":794,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/infra/conf/transport_method.go#L758-L794","documentation":"Thrown by HysteriaConfig.Build() when the config's version field is not 2. The core only implements the Hysteria2 protocol; version 1 configs are not buildable, and a missing/zero version also fails since 0 != 2.","triggerScenarios":"Supplying a hysteria transport block with \"version\": 1 or omitting the version field entirely.","commonSituations":"Porting a Hysteria1 config to Xray, or writing a new hysteria block from a tutorial that predates the version requirement.","solutions":["Set \"version\": 2 in the hysteria settings block.","If you genuinely need Hysteria1, run the standalone Hysteria1 server/client instead of this core."],"exampleFix":"// before\n\"hysteriaSettings\": { \"servers\": [ ... ] } // version missing\n// after\n\"hysteriaSettings\": { \"version\": 2, \"servers\": [ ... ] }","handlingStrategy":"validation","validationCode":"if h.Version != 2 {\n    return errors.New(\"only hysteria version 2 is supported\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin version: 2 in every hysteria template you maintain.","Treat hysteria1 configs as needing migration, not a version tweak."],"tags":["config","hysteria","protocol-version","validation","go"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}