kubernetes/kops · error

invalid Azure Blob scheme: %q

Error message

invalid Azure Blob scheme: %q

What it means

buildAzureBlobPath enforces the azureblob:// scheme; any other scheme returns "invalid Azure Blob scheme". Because BuildVfsPath selects the builder from the scheme, reaching this check means a non-azureblob URL was handed to the Azure builder.

Source

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

	if bucket == "" {
		return nil, fmt.Errorf("invalid swift path: %q", p)
	}

	return NewSwiftPath(c, bucket, u.Path)
}

func (c *VFSContext) buildAzureBlobPath(p string) (*AzureBlobPath, error) {
	if os.Getenv("AZURE_STORAGE_ACCOUNT") != "" {
		return nil, fmt.Errorf("unset AZURE_STORAGE_ACCOUNT; the storage account belongs in the URL:  azureblob://<account>/<container>/<key>")
	}

	u, err := url.Parse(p)
	if err != nil {
		return nil, fmt.Errorf("failed to parse %q: %s", p, err)
	}

	if u.Scheme != "azureblob" {
		return nil, fmt.Errorf("invalid Azure Blob scheme: %q", p)
	}

	account := strings.TrimSuffix(u.Host, "/")
	if account == "" {
		return nil, fmt.Errorf("no storage account specified in %q; expected azureblob://<account>/<container>/<key>", p)
	}

	rest := strings.TrimPrefix(u.Path, "/")
	container, key, _ := strings.Cut(rest, "/")
	if container == "" {
		return nil, fmt.Errorf("no container specified in %q; expected azureblob://<account>/<container>/<key>", p)
	}

	return NewAzureBlobPath(c, account, container, key), nil
}

// getAzureBlobClient returns the client for azure blob storage for the given
// storage account, caching it for future reuse.

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Change the scheme to exactly "azureblob://<account>/<container>/<key>"
  2. Replace https:// ARM/resource-manager URLs with the azureblob:// VFS form
  3. Fix scheme typos and ensure the prefix survives templating/joining
  4. Let BuildVfsPath dispatch on scheme rather than calling buildAzureBlobPath with a foreign-scheme URL

Example fix

// before
context.BuildVfsPath("azure://mystorage/container/state")
// after
context.BuildVfsPath("azureblob://mystorage/container/state")
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

func isAzureBlobPath(p string) bool { u, err := url.Parse(p); return err == nil && u.Scheme == "azureblob" }

Try / catch

if _, err := context.BuildVfsPath(p); err != nil { if strings.Contains(err.Error(), "invalid Azure Blob scheme") { /* correct the scheme to azureblob:// and retry */ } return err }

Prevention

When it happens

Trigger: BuildVfsPath with a URL whose parsed scheme is not exactly "azureblob" — e.g. azure://, azblob://, https:// storage endpoints, or a bare host-less string with empty scheme routed to this builder.

Common situations: Typo in scheme ("azurblob://"); using the generic https:// ARM endpoint instead of the azureblob:// VFS form; config examples from other tools (azcopy, SDK) that use different URL shapes.

Related errors


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