{"record":{"id":"78da323a77f9c215","repo":"thanos-io/thanos","slug":"copy-symbols","errorCode":null,"errorMessage":"copy symbols","messagePattern":"copy symbols","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/block/indexheader/binary_reader.go","lineNumber":260,"sourceCode":"\t\treturn nil, errors.Wrap(err, \"close toc reader\")\n\t}\n\n\ttoc, err := index.NewTOCFromByteSlice(realByteSlice(tocBytes))\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"new TOC\")\n\t}\n\treturn toc, nil\n}\n\nfunc (r *chunkedIndexReader) CopySymbols(w io.Writer, buf []byte) (err error) {\n\trc, err := r.bkt.GetRange(r.ctx, r.path, int64(r.toc.Symbols), int64(r.toc.Series-r.toc.Symbols))\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"get symbols from object storage of %s\", r.path)\n\t}\n\tdefer runutil.CloseWithErrCapture(&err, rc, \"close symbol reader\")\n\n\tif _, err := io.CopyBuffer(w, rc, buf); err != nil {\n\t\treturn errors.Wrap(err, \"copy symbols\")\n\t}\n\n\treturn nil\n}\n\nfunc (r *chunkedIndexReader) CopyPostingsOffsets(w io.Writer, buf []byte) (err error) {\n\trc, err := r.bkt.GetRange(r.ctx, r.path, int64(r.toc.PostingsTable), int64(r.size-r.toc.PostingsTable))\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"get posting offset table from object storage of %s\", r.path)\n\t}\n\tdefer runutil.CloseWithErrCapture(&err, rc, \"close posting offsets reader\")\n\n\tif _, err := io.CopyBuffer(w, rc, buf); err != nil {\n\t\treturn errors.Wrap(err, \"copy posting offsets\")\n\t}\n\n\treturn nil\n}","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/block/indexheader/binary_reader.go#L242-L278","documentation":"CopySymbols fetched the symbols range successfully but io.CopyBuffer failed while streaming it into the destination writer, wrapped with 'copy symbols'. The underlying reader is closed with error capture via defer.","triggerScenarios":"CopySymbols when io.CopyBuffer(w, rc, buf) errors: destination writer (the index-header file being written) fails — disk full, local I/O error — or the source body read fails mid-stream (network drop, context cancel).","commonSituations":"Disk full on the store-gateway volume where index-headers are cached; local filesystem permission or I/O errors; network interruption during a large symbols section read; context deadline from a slow copy.","solutions":["Inspect the wrapped error: ENOSPC/EACCES on the writer means free disk space or fix permissions on the index-header cache directory.","If the error is a read/network failure, retry the copy; enable objstore retries.","Enlarge the local cache volume or cap its usage to avoid disk-full during header builds.","Check context deadlines if the copy is canceled by timeouts/shutdown."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if free, _ := diskFree(cacheDir); free < minRequiredBytes {\n    return fmt.Errorf(\"insufficient disk for index-header cache: %s\", cacheDir)\n}","typeGuard":null,"tryCatchPattern":"var perr *fs.PathError\nif errors.As(err, &perr) {\n    // local write failed: check disk space/permissions on cache dir\n} else if errors.Is(err, context.DeadlineExceeded) {\n    // retry copy with larger deadline\n}","preventionTips":["Monitor free space on the index-header cache volume and alert before full.","Use retrying bucket clients so mid-stream read failures are retried.","Keep cache dir writable by the Thanos process user.","Size timeouts to accommodate large symbols sections from high-cardinality blocks."],"tags":["io","disk","object-storage","thanos"],"backgroundTag":"file-write-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"}