{"record":{"id":"d88ddb324036ecb4","repo":"microsoft/aspire","slug":"the-value-config-version-is-not-a-valid-http-version","errorCode":null,"errorMessage":"The value '{config.Version}' is not a valid HTTP version. Expected format is 'major.minor', for example '1.1' or '2.0'.","messagePattern":"The value '(.+?)' is not a valid HTTP version\\. Expected format is 'major\\.minor', for example '1\\.1' or '2\\.0'\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Yarp/ConfigurationBuilder/YarpCluster.cs","lineNumber":302,"sourceCode":"    [AspireExport(\"withClusterMetadata\", MethodName = \"withMetadata\")]\n    public static YarpCluster WithMetadata(this YarpCluster cluster, IReadOnlyDictionary<string, string> metadata)\n    {\n        cluster.Configure(c => c with { Metadata = metadata });\n        return cluster;\n    }\n\n    // These mappings keep the existing public YARP-config overloads for .NET callers while exposing\n    // ATS-friendly DTO shapes for polyglot callers. The raw YARP types include nested config objects,\n    // Version values, and flags enums that do not round-trip cleanly through ATS as-is.\n    private static ForwarderRequestConfig ToForwarderRequestConfig(YarpForwarderRequestConfig config)\n    {\n        Version? parsedVersion = null;\n\n        if (!string.IsNullOrWhiteSpace(config.Version))\n        {\n            if (!Version.TryParse(config.Version, out var version))\n            {\n                throw new ArgumentException(\n                    $\"The value '{config.Version}' is not a valid HTTP version. Expected format is 'major.minor', for example '1.1' or '2.0'.\",\n                    nameof(config));\n            }\n\n            parsedVersion = version;\n        }\n\n        return new ForwarderRequestConfig\n        {\n            ActivityTimeout = config.ActivityTimeout,\n            AllowResponseBuffering = config.AllowResponseBuffering,\n            Version = parsedVersion,\n            VersionPolicy = config.VersionPolicy,\n        };\n    }\n\n    private static HttpClientConfig ToHttpClientConfig(YarpHttpClientConfig config)\n    {","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Yarp/ConfigurationBuilder/YarpCluster.cs#L284-L320","documentation":"Thrown by YarpCluster.ToForwarderRequestConfig when config.Version is non-empty but not parseable as a System.Version (major.minor). YARP forwards this value as the HTTP request version, so it must be like \"1.1\", \"2.0\", or \"3.0\". The library validates the string early to fail fast instead of YARP failing later.","triggerScenarios":"Calling cluster.WithForwarderRequestConfig(...) with a YarpForwarderRequestConfig whose Version string is e.g. \"2\", \"v1.1\", \"1.1.1.1\" with an invalid segment, \"HTTP/2\", or \"two\".","commonSituations":"Copying a version string from an HttpClient property like \"2.0\" with surrounding text; using \"1.0.1\" full-build style versions; writing \"http/2\" out of habit; typos like \"1,1\".","solutions":["Pass a valid major.minor string, e.g. Version = \"1.1\" or Version = \"2.0\".","If the version is optional, set Version to null or omit it instead of an empty placeholder string.","Normalize inputs with Version.TryParse before constructing YarpForwarderRequestConfig."],"exampleFix":"// before\nnew YarpForwarderRequestConfig { Version = \"http/2\" }\n// after\nnew YarpForwarderRequestConfig { Version = \"2.0\" }","handlingStrategy":"validation","validationCode":"if (!string.IsNullOrWhiteSpace(config.Version) && !Version.TryParse(config.Version, out _))\n{\n    throw new InvalidOperationException($\"'{config.Version}' is not a valid HTTP version; use e.g. '1.1' or '2.0'.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only use \"1.1\", \"2.0\", or \"3.0\" literals for Version.","Validate user- or config-supplied versions with Version.TryParse before building config.","Prefer leaving Version null when the default behavior is acceptable."],"tags":["yarp","http-version","validation","configuration"],"backgroundTag":"invalid-config-value","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}