{"record":{"id":"c49297141a3a7b61","repo":"jaegertracing/jaeger","slug":"invalid-version-format-s","errorCode":null,"errorMessage":"invalid version format: %s","messagePattern":"invalid version format: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/elasticsearch/backend_version.go","lineNumber":134,"sourceCode":"// data-plane and admin-plane client builders. It returns the configured version\n// when it is non-zero (an explicit override, honored without a network call);\n// otherwise it calls ping once and derives the version from the response.\nfunc ResolveBackendVersion(ctx context.Context, configured uint, ping func(context.Context) (PingResult, error)) (BackendVersion, error) {\n\tif configured != 0 {\n\t\treturn BackendVersion(configured), nil\n\t}\n\tresult, err := ping(ctx)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif result.VersionNumber == \"\" {\n\t\treturn 0, errors.New(\"backend returned an empty version number\")\n\t}\n\t// Parse the whole major component (up to the first dot), not just the first\n\t// byte — otherwise \"10.x\" would be misread as major 1.\n\tmajorVersion, err := strconv.Atoi(strings.Split(result.VersionNumber, \".\")[0])\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"invalid version format: %s\", result.VersionNumber)\n\t}\n\treturn DetectBackendVersion(result.TagLine, majorVersion), nil\n}\n\n// DetectBackendVersion determines the BackendVersion from the ping response.\nfunc DetectBackendVersion(tagLine string, majorVersion int) BackendVersion {\n\tif strings.Contains(tagLine, \"OpenSearch\") {\n\t\tswitch majorVersion {\n\t\tcase 1:\n\t\t\treturn OpenSearch1\n\t\tcase 2:\n\t\t\treturn OpenSearch2\n\t\tdefault:\n\t\t\treturn OpenSearch3\n\t\t}\n\t}\n\tswitch majorVersion {\n\tcase 7:","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/elasticsearch/backend_version.go#L116-L152","documentation":"ResolveBackendVersion parses the major version component returned by the backend's ping/info endpoint and fails when that string is not a valid integer. Unlike ParseBackendVersion, the invalid input comes from the server's reported version number, so this usually indicates a nonstandard or proxied backend response.","triggerScenarios":"Calling ResolveBackendVersion against a backend whose info endpoint returns a VersionNumber that doesn't start with an integer (e.g. a proxy/mocked endpoint returning \"unknown\", \"7.x-SNAPSHOT\", or HTML from an incorrect URL).","commonSituations":"Pointing Jaeger at a reverse proxy that intercepts / and returns HTML; OpenSearch forks or managed services reporting unusual version strings; connecting to the wrong port/service that answers with something other than ES/OS.","solutions":["Verify the configured URL points directly at the ES/OpenSearch root endpoint (not a proxy or UI route) and that GET / returns JSON with version.number.","Curl the endpoint and inspect version.number; fix the address or proxy passthrough if it isn't a numeric major like '7.17.9'.","Use an explicit config Version (7/8/9/101/102/103) to bypass auto-detection if the backend reports a nonstandard string.","Upgrade/downgrade the managed service or fork if it reports an incompatible version format.","Check that no auth redirect is converting the info request into an HTML login page."],"exampleFix":"# diagnose\ncurl -s http://es:9200/ | jq .version.number   # must be like \"7.17.9\"\n// before (auto-detect fails)\nconfig := esconfig.Configuration{Servers: []string{\"http://es:9200\"}}\n// after\nconfig := esconfig.Configuration{Servers: []string{\"http://es:9200\"}, Version: 7}","handlingStrategy":"validation","validationCode":"resp, err := http.Get(serverURL)\nif err == nil {\n    var info struct{ Version struct{ Number string `json:\"number\"` } `json:\"version\"` }\n    json.NewDecoder(resp.Body).Decode(&info)\n    if _, cerr := strconv.Atoi(strings.Split(info.Version.Number, \".\")[0]); cerr != nil {\n        log.Printf(\"backend reports non-numeric version %q; fix URL or pin explicit Version\", info.Version.Number)\n    }\n}","typeGuard":null,"tryCatchPattern":"v, err := es.ResolveBackendVersion(client)\nif err != nil {\n    if strings.Contains(err.Error(), \"invalid version format\") {\n        // fall back to explicit version instead of auto-detect\n        return configuredVersion // e.g. 7\n    }\n    return err\n}","preventionTips":["Curl the ES/OS root endpoint in CI to verify version.number is numeric.","Bypass proxies/ingresses for the info endpoint or ensure they pass through JSON.","Pin an explicit Version when using managed services or forks with odd version strings.","Check for auth redirects that turn the info request into HTML."],"tags":["elasticsearch","opensearch","version-detection","http"],"backgroundTag":"backend-version-detection-failed","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}