kubernetes/kops · error
Path %q is not a child of %q
Error message
Path %q is not a child of %q
What it means
Validation guard in RelativePath: the child path's string form does not start with the base path (plus a trailing "/"), so the child is not actually located under the base. This fires when callers pass unrelated or sibling paths — e.g. a keyset or cluster-state object whose VFS location escapes the cluster's base directory — and no relative path can be computed.
Source
Thrown at util/pkg/vfs/vfs.go:109
}
type HasHash interface {
// Returns the hash of the file contents, with the preferred hash algorithm
PreferredHash() (*hashing.Hash, error)
// Gets the hash, or nil if the hash cannot be (easily) computed
Hash(algorithm hashing.HashAlgorithm) (*hashing.Hash, error)
}
func RelativePath(base Path, child Path) (string, error) {
basePath := base.Path()
childPath := child.Path()
if !strings.HasSuffix(basePath, "/") {
basePath += "/"
}
if !strings.HasPrefix(childPath, basePath) {
return "", fmt.Errorf("Path %q is not a child of %q", child, base)
}
relativePath := childPath[len(basePath):]
return relativePath, nil
}
func IsClusterReadable(p Path) bool {
if hcr, ok := p.(HasClusterReadable); ok {
return hcr.IsClusterReadable()
}
switch p.(type) {
case *S3Path, *GSPath, *SwiftPath, *FSPath, *AzureBlobPath:
return true
case *KubernetesPath:
return true
View on GitHub (pinned to 4c8573c808)
Solutions
- Check that both paths come from the same VFS root and the base is a true ancestor of the child
- Normalize paths (resolve trailing slashes, canonicalize scheme and host) before comparing
- Reject or skip objects outside the expected prefix instead of forcing the computation
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at util/pkg/vfs/vfs.go:109 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/5676fbe4db8417c2.
Report an issue: GitHub.