kubernetes/kops · error

error writing %s: %v

Error message

error writing %s: %v

What it means

Returned inside SwiftPath.WriteFile's retry loop when the Swift object create (upload) call fails other than with not-found. The object storage rejected the write — auth expiry, container permissions, quota, or a transient proxy 5xx — and RetryWithBackoff re-attempts the upload with swiftWriteBackoff timing.

Source

Thrown at util/pkg/vfs/swiftfs.go:399

		key:        joined,
	}
}

func (p *SwiftPath) WriteFile(ctx context.Context, data io.ReadSeeker, acl ACL) error {
	done, err := RetryWithBackoff(swiftWriteBackoff, func() (bool, error) {
		client, err := p.getClient(ctx)
		if err != nil {
			return false, err
		}

		klog.V(4).Infof("Writing file %q", p)
		if _, err := data.Seek(0, 0); err != nil {
			return false, fmt.Errorf("error seeking to start of data stream for %s: %v", p, err)
		}

		createOpts := swiftobject.CreateOpts{Content: data}
		if _, err := swiftobject.Create(ctx, client, p.bucket, p.key, createOpts).Extract(); err != nil {
			return false, fmt.Errorf("error writing %s: %v", p, err)
		}

		return true, nil
	})
	if err != nil {
		return err
	} else if done {
		return nil
	} else {
		// Shouldn't happen - we always return a non-nil error with false.
		return wait.ErrWaitTimeout
	}
}

// To prevent concurrent creates on the same file while maintaining atomicity of writes,
// we take a process-wide lock during the operation.
// Not a great approach, but fine for a single process (with low concurrency).
// TODO: should we enable versioning?

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Verify container write permissions and account quota
  2. Allow the backoff loop to handle transient proxy errors; inspect the wrapped error if retries exhaust
  3. Re-seek the data stream before retrying, since each attempt reads it from the start
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at util/pkg/vfs/swiftfs.go:399 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/6c8e6a1d43e2c3a0. Report an issue: GitHub.