kubernetes/kops · error

error writing %s: %v

Error message

error writing %s: %v

What it means

Create() wrote the new object to VFS with WriteOptionCreate and the write failed with an error other than os.IsExist (which would be returned as-is). The underlying storage error is wrapped as 'error writing <kind>'.

Source

Thrown at pkg/client/simple/vfsclientset/commonvfs.go:102

	if c.validate != nil {
		err = c.validate(i)
		if err != nil {
			return err
		}
	}

	creationTimestamp := objectMeta.GetCreationTimestamp()
	if creationTimestamp.IsZero() {
		objectMeta.SetCreationTimestamp(metav1.NewTime(time.Now().UTC()))
	}

	err = c.writeConfig(ctx, cluster, c.basePath.Join(objectMeta.GetName()), i, vfs.WriteOptionCreate)
	if err != nil {
		if os.IsExist(err) {
			return err
		}
		return fmt.Errorf("error writing %s: %v", c.kind, err)
	}

	return nil
}

func (c *VFSClientBase) serialize(o runtime.Object) ([]byte, error) {
	var b bytes.Buffer
	err := c.encoder.Encode(o, &b)
	if err != nil {
		return nil, fmt.Errorf("error encoding object: %v", err)
	}

	return b.Bytes(), nil
}

func (c *VFSClientBase) readConfig(ctx context.Context, configPath vfs.Path) (runtime.Object, error) {
	data, err := configPath.ReadFile(ctx)
	if err != nil {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Inspect the wrapped cause (%v) for the storage-level error.
  2. Check bucket write IAM permissions / KMS key policy.
  3. Retry on transient throttling/network errors with backoff.
  4. Verify the bucket is writable and in the expected region: `aws s3 cp test s3://bucket/`.
Defensive patterns

Strategy: retry

Validate before calling

if err := verifyStateStoreWriteAccess(ctx, stateStore); err != nil {
    return fmt.Errorf("state store not writable: %w", err)
}

Try / catch

err := client.Create(ctx, obj)
if err != nil && !os.IsExist(err) {
    if isRetryable(err) { return retryWithBackoff(...) }
    return fmt.Errorf("create failed: %w", err)
}

Prevention

When it happens

Trigger: Create on a vfs clientset where writeConfig's WriteOptionCreate write fails due to permissions, network, throttling, or backend errors.

Common situations: Bucket write permissions missing (s3:PutObject denied); S3 throttling during `kops create cluster`; transient network failure; KMS/bucket policy blocking uploads.

Related errors


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