{"record":{"id":"9081d3564602e0c0","repo":"thanos-io/thanos","slug":"failed-to-find-config-version-s","errorCode":null,"errorMessage":"failed to find config version: %s","messagePattern":"failed to find config version: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/discovery/memcache/resolver.go","lineNumber":82,"sourceCode":"\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read config metadata: %s\", err)\n\t}\n\tconfigMeta = strings.TrimSpace(configMeta)\n\n\t// First line should be \"CONFIG cluster 0 [length-of-payload-]\n\tconfigMetaComponents := strings.Split(configMeta, \" \")\n\tif len(configMetaComponents) != 4 {\n\t\treturn nil, fmt.Errorf(\"expected 4 components in config metadata, and received %d, meta: %s\", len(configMetaComponents), configMeta)\n\t}\n\n\tconfigSize, err := strconv.Atoi(configMetaComponents[3])\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse config size from metadata: %s, error: %s\", configMeta, err)\n\t}\n\n\tconfigVersion, err := reader.ReadString('\\n')\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to find config version: %s\", err)\n\t}\n\tclusterConfig.version, err = strconv.Atoi(strings.TrimSpace(configVersion))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parser config version: %s\", err)\n\t}\n\n\tnodes, err := reader.ReadString('\\n')\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read nodes: %s\", err)\n\t}\n\n\tif len(configVersion)+len(nodes) != configSize {\n\t\treturn nil, fmt.Errorf(\"expected %d in config payload, but got %d instead\", configSize, len(configVersion)+len(nodes))\n\t}\n\n\tfor host := range strings.SplitSeq(strings.TrimSpace(nodes), \" \") {\n\t\tdnsIpPort := strings.Split(host, \"|\")\n\t\tif len(dnsIpPort) != 3 {","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/discovery/memcache/resolver.go#L64-L100","documentation":"After the metadata line, the CONFIG payload's first line is the cluster version number. parseConfig reads it with ReadString('\\n'); this error is returned when that read fails — usually io.EOF because the stream ended right after the metadata line, or a connection error. It means the response was truncated before the version line arrived.","triggerScenarios":"The reader contains only the metadata line and then ends; the connection drops after the header; the response is cut off by a short read timeout or premature close.","commonSituations":"Connections closed prematurely under load; servers sending the header but failing to write the payload; flaky networks between client and ElastiCache; LB idle-timeout resets.","solutions":["Fix server-side framing so the full payload always follows the metadata line.","Investigate connection stability (timeouts, keep-alives, LB idle timeouts).","Retry Resolve with backoff to rule out transient disconnects.","Check for io.EOF in the wrapped error to distinguish truncation from real I/O errors."],"exampleFix":"// before\ncfg, err := parseConfig(reader) // EOF after metadata line\n// after\ncfg, err := parseConfig(reader)\nif err != nil && strings.Contains(err.Error(), \"config version\") {\n    return retryFetchConfig() // truncated response; refetch\n}","handlingStrategy":"retry","validationCode":"func hasFullPayload(meta string, reader *bufio.Reader) bool {\n    parts := strings.Fields(meta)\n    if len(parts) != 4 {\n        return false\n    }\n    size, err := strconv.Atoi(parts[3])\n    return err == nil && reader.Buffered() >= size\n}","typeGuard":null,"tryCatchPattern":"cfg, err := discovery.parseConfig(reader)\nif err != nil && strings.Contains(err.Error(), \"failed to find config version\") {\n    return backoff.Retry(func() error { cfg, err = refetchConfig(addr); return err }, b)\n}","preventionTips":["Ensure servers always write the complete payload after the metadata line.","Use read deadlines plus retry/backoff for truncated transfers.","Watch for LB/proxy idle timeouts cutting short responses.","Retry idempotent config fetches on EOF-style truncation."],"tags":["memcached","io","truncated-response","protocol"],"backgroundTag":"file-read-failed","analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}