kubernetes/kops · error

refusing to delete: unknown file found: %s

Error message

refusing to delete: unknown file found: %s

What it means

A deliberate safety guard in DeleteAllClusterState: the state store contains a file outside the kOps-managed prefixes (config, pki, secrets, instancegroup, igconfig, manifests, backups), so kOps refuses the recursive RemoveAll to avoid destroying unrecognized data.

Source

Thrown at pkg/client/simple/vfsclientset/clientset.go:186

		}
		if strings.HasPrefix(relativePath, "secrets/") {
			continue
		}
		if strings.HasPrefix(relativePath, "instancegroup/") {
			continue
		}
		if strings.HasPrefix(relativePath, "igconfig/") {
			continue
		}
		if strings.HasPrefix(relativePath, "manifests/") {
			continue
		}
		// TODO: offer an option _not_ to delete backups?
		if strings.HasPrefix(relativePath, "backups/") {
			continue
		}

		return fmt.Errorf("refusing to delete: unknown file found: %s", path)
	}

	err = basePath.RemoveAll(ctx)
	if err != nil {
		return fmt.Errorf("error deleting cluster files in %s: %w", basePath, err)
	}

	return nil
}

func (c *VFSClientset) DeleteCluster(ctx context.Context, cluster *kops.Cluster) error {
	if cluster.Spec.ServiceAccountIssuerDiscovery != nil {
		discoveryStore := cluster.Spec.ServiceAccountIssuerDiscovery.DiscoveryStore
		if discoveryStore != "" {
			path, err := c.VFSContext().BuildVfsPath(discoveryStore)
			if err != nil {
				return err
			}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Inspect the listed file in the state store and move or delete it manually if unwanted
  2. Confirm the state store is exclusively kOps-managed and not shared with other tools
  3. Re-run the cluster deletion once the unknown file is resolved
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/client/simple/vfsclientset/clientset.go:186 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/9b263abeaf2ef3ef. Report an issue: GitHub.