{"record":{"id":"2533ac1cf8233802","repo":"kubernetes/kops","slug":"error-seeking-to-start-of-data-stream-for-s-v","errorCode":null,"errorMessage":"error seeking to start of data stream for %s: %v","messagePattern":"error seeking to start of data stream for (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/pkg/vfs/swiftfs.go","lineNumber":394,"sourceCode":"\targs = append(args, relativePath...)\n\tjoined := path.Join(args...)\n\treturn &SwiftPath{\n\t\tvfsContext: p.vfsContext,\n\t\tbucket:     p.bucket,\n\t\tkey:        joined,\n\t}\n}\n\nfunc (p *SwiftPath) WriteFile(ctx context.Context, data io.ReadSeeker, acl ACL) error {\n\tdone, err := RetryWithBackoff(swiftWriteBackoff, func() (bool, error) {\n\t\tclient, err := p.getClient(ctx)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\tklog.V(4).Infof(\"Writing file %q\", p)\n\t\tif _, err := data.Seek(0, 0); err != nil {\n\t\t\treturn false, fmt.Errorf(\"error seeking to start of data stream for %s: %v\", p, err)\n\t\t}\n\n\t\tcreateOpts := swiftobject.CreateOpts{Content: data}\n\t\tif _, err := swiftobject.Create(ctx, client, p.bucket, p.key, createOpts).Extract(); err != nil {\n\t\t\treturn false, fmt.Errorf(\"error writing %s: %v\", p, err)\n\t\t}\n\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t} else if done {\n\t\treturn nil\n\t} else {\n\t\t// Shouldn't happen - we always return a non-nil error with false.\n\t\treturn wait.ErrWaitTimeout\n\t}\n}","sourceCodeStart":376,"sourceCodeEnd":412,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/util/pkg/vfs/swiftfs.go#L376-L412","documentation":"Returned inside SwiftPath.WriteFile's retry loop when the caller-supplied io.ReadSeeker cannot be rewound to offset 0 before upload. The stream itself is faulty — already consumed and unseekable, or wrapped by a failing reader — so the object bytes cannot be staged for the Swift create call; this is a local data-stream error, not a Swift API error.","triggerScenarios":"Thrown at util/pkg/vfs/swiftfs.go:394 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a bytes.Reader or ensure the ReadSeeker supports Seek to the start","Re-create the data stream if it was consumed by an earlier attempt (e.g. a previous retry in the backoff loop)"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}