kubernetes/kops · error

invalid Hetzner object storage path: %q

Error message

invalid Hetzner object storage path: %q

What it means

buildHetznerPath validates that a Hetzner Object Storage VFS path uses the "hos" scheme. The path parsed as a URL successfully but its scheme is not exactly "hos", so kOps refuses to treat it as Hetzner Object Storage and throws this error.

Source

Thrown at util/pkg/vfs/context.go:440

		// Akamai (Linode) requires checksum-when-required behavior
		o.RequestChecksumCalculation = aws.RequestChecksumCalculationWhenRequired
		o.ResponseChecksumValidation = aws.ResponseChecksumValidationWhenRequired
	})
	return s3path, nil
}

func (c *VFSContext) buildHetznerPath(p string) (*S3Path, error) {
	endpoint := os.Getenv("S3_ENDPOINT")
	if endpoint == "" {
		return nil, fmt.Errorf("required S3_ENDPOINT env var for path: %q", p)
	}

	u, err := url.Parse(p)
	if err != nil {
		return nil, fmt.Errorf("invalid Hetzner Object Storage path: %q", p)
	}
	if u.Scheme != "hos" {
		return nil, fmt.Errorf("invalid Hetzner object storage path: %q", p)
	}

	bucket := strings.TrimSuffix(u.Host, "/")
	if bucket == "" {
		return nil, fmt.Errorf("invalid Hetzner object storage path: %q", p)
	}

	s3path := newS3Path(c.s3Context, u.Scheme, bucket, u.Path, false, func(o *s3.Options) {
		o.BaseEndpoint = aws.String(endpoint)
		o.UsePathStyle = true
		o.DisableLogOutputChecksumValidationSkipped = true
	})
	return s3path, nil
}

func (c *VFSContext) buildKubernetesPath(p string) (*KubernetesPath, error) {
	u, err := url.Parse(p)
	if err != nil {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Change the scheme to lowercase hos://, e.g. --state-store=hos://my-bucket
  2. If you actually intend AWS S3, set the state store to s3://bucket so BuildVfsPath routes to the S3 builder instead
  3. Ensure no hidden prefix (BOM, whitespace) before "hos://" in the value

Example fix

// before
--state-store=s3://my-bucket  # dispatched to Hetzner builder
// after
--state-store=hos://my-bucket
Defensive patterns

Strategy: validation

Validate before calling

u, err := url.Parse(stateStore)
if err != nil || u.Scheme != "hos" {
	return fmt.Errorf("Hetzner state store must use the hos:// scheme, got %q", stateStore)
}

Try / catch

p, err := vfs.Context.BuildVfsPath(stateStore)
if err != nil {
	if strings.Contains(err.Error(), "invalid Hetzner object storage path") {
		return fmt.Errorf("expected hos:// scheme for Hetzner Object Storage: %w", err)
	}
	return err
}

Prevention

When it happens

Trigger: BuildVfsPath dispatches to buildHetznerPath with a path like "s3://bucket", "https://bucket", "HOS://bucket", or "host://bucket" — url.Parse succeeds but u.Scheme != "hos".

Common situations: Using an s3:// or standard https:// state store URL while kOps was configured for Hetzner; capitalizing the scheme (URL schemes are lowercased by convention but compared case-sensitively here); copying an AWS-style config and forgetting to change the scheme.

Related errors


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