kubernetes/kops · error

error reading %s %q: %v

Error message

error reading %s %q: %v

What it means

VFSClientBase.Find could not read the object file from the state store for a reason other than not-exist (which would return nil,nil). The underlying VFS read error (permissions, network, corrupt backend) is wrapped with the kind and object name.

Source

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

	codecs := kopscodecs.Codecs
	yaml, ok := runtime.SerializerInfoForMediaType(codecs.SupportedMediaTypes(), "application/yaml")
	if !ok {
		klog.Fatalf("no YAML serializer registered")
	}
	c.encoder = codecs.EncoderForVersion(yaml.Serializer, storeVersion)

	c.kind = kind
	c.vfsContext = vfsContext
	c.basePath = basePath
}

func (c *VFSClientBase) Find(ctx context.Context, name string) (runtime.Object, error) {
	o, err := c.readConfig(ctx, c.basePath.Join(name))
	if err != nil {
		if os.IsNotExist(err) {
			return nil, nil
		}
		return nil, fmt.Errorf("error reading %s %q: %v", c.kind, name, err)
	}
	return o, nil
}

func (c *VFSClientBase) List(ctx context.Context, items interface{}, options metav1.ListOptions) (interface{}, error) {
	return c.readAll(ctx, items)
}

func (c *VFSClientBase) create(ctx context.Context, cluster *kops.Cluster, i runtime.Object) error {
	objectMeta, err := meta.Accessor(i)
	if err != nil {
		return err
	}

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

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Read the wrapped %v cause to identify the storage error (AccessDenied, NoSuchBucket, timeout).
  2. Verify cloud credentials and IAM permissions for the state store bucket.
  3. Confirm the --state flag / KOPS_STATE_STORE points at the correct bucket and region.
  4. Retry on transient network/throttling errors with backoff.

Example fix

// before
kops get cluster --name prod --state s3://wrong-bucket
// after
export KOPS_STATE_STORE=s3://correct-state-bucket
aws s3 ls $KOPS_STATE_STORE/  # verify access first
Defensive patterns

Strategy: try-catch

Validate before calling

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

Try / catch

o, err := client.Get(ctx, name)
if err != nil {
    var cause error
    if errors.As(err, &cause) && isRetryable(cause) {
        return retryWithBackoff(...)
    }
    return fmt.Errorf("reading cluster %q: %w", name, err)
}

Prevention

When it happens

Trigger: Get() or readAll() on a vfs clientset where basePath.Join(name).ReadFile fails with e.g. S3 access denied, throttling, or I/O error — anything except os.ErrNotExist.

Common situations: Expired/insufficient cloud credentials (S3, GCS); wrong --state s3:// bucket; region misconfiguration; bucket deleted or permissions revoked; network outage.

Related errors


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