kubernetes/kops · error

error building path %q: %v

Error message

error building path %q: %v

What it means

After downloading, transferFile converts the target URL to a VFS path and calls vfsContext.BuildVfsPath(objectStore); failure to construct a usable path object is wrapped as 'error building path <objectStore>: <reason>'. This means the VFS layer could not interpret or connect for the target location.

Source

Thrown at pkg/assets/assetcopy/copyfile.go:124

	// TODO in s3 can we do a copy file ... would need to test

	data, err := vfsContext.ReadFile(source)
	if err != nil {
		if os.IsNotExist(err) {
			return fmt.Errorf("file not found %q: %v", source, err)
		}

		return fmt.Errorf("error downloading file %q: %v", source, err)
	}

	objectStore, err := buildVFSPath(target)
	if err != nil {
		return err
	}

	uploadVFS, err := vfsContext.BuildVfsPath(objectStore)
	if err != nil {
		return fmt.Errorf("error building path %q: %v", objectStore, err)
	}

	shaExtension, err := fileExtensionForSHA(sha)
	if err != nil {
		return err
	}

	shaTarget := objectStore + shaExtension
	shaVFS, err := vfsContext.BuildVfsPath(shaTarget)
	if err != nil {
		return fmt.Errorf("error building path %q: %v", shaTarget, err)
	}

	shaHash, err := hashing.FromString(strings.TrimSpace(sha))
	if err != nil {
		return fmt.Errorf("unable to parse sha: %q, %v", sha, err)
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check the objectStore path in the message for a valid scheme and bucket name.
  2. Ensure the file-repository flag uses s3://, gs://, azureblob://, file://, or a recognized S3/GCS HTTPS URL.
  3. Validate cloud client configuration/credentials needed to open the target path.
  4. Re-run `kops get assets --copy` after correcting the repository URL.

Example fix

// before
--file-repository s3://Bucket_With_Underscores/path
// after
--file-repository s3://my-assets-bucket/path
Defensive patterns

Strategy: validation

Validate before calling

// Validate the target repository URL form before invoking kops:
var re = regexp.MustCompile(`^(s3|gs|azureblob|file|memfs)://[a-z0-9][a-z0-9.-]{2,62}/`)
if !re.MatchString(fileRepository) && !strings.Contains(fileRepository, "://") {
    return fmt.Errorf("unsupported file repository: %s", fileRepository)
}

Prevention

When it happens

Trigger: The objectStore path (already normalized by buildVFSPath to s3://, gs://, azureblob://, file://, or memfs://) cannot be built — e.g. malformed bucket name, unknown VFS scheme, or an underlying storage-client initialization error.

Common situations: A file-repository URL that buildVFSPath passed through unchanged but that the VFS backend rejects (e.g. unsupported scheme or invalid bucket); misconfigured cloud credentials preventing the backend from being constructed.

Related errors


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