googleapis/mcp-toolbox · error
path %q cannot be resolved within %q: %w
Error message
path %q cannot be resolved within %q: %w
What it means
Wrap of an unexpected filepath.Rel failure inside the escapes() helper: the OS could not compute the relation between the cleaned destination and the configured directory (for example mixed volume names on Windows).
Source
Thrown at internal/tools/cloudstorage/cloudstoragecommon/paths.go:138
// inside dir, both as written and after symlinks are resolved. The returned
// path is the cleaned join, not the symlink-resolved target, so callers keep
// reporting the location the user asked for.
func ResolveWithinDir(dir, rel string) (string, error) {
cleanDir, err := ValidateLocalPath(dir)
if err != nil {
return "", fmt.Errorf("directory %q is invalid: %w", dir, err)
}
if rel == "" {
return "", fmt.Errorf("relative path is empty")
}
if filepath.IsAbs(rel) {
return "", fmt.Errorf("path %q must be relative", rel)
}
cleanDest := filepath.Clean(filepath.Join(cleanDir, rel))
out, err := escapes(cleanDir, cleanDest)
if err != nil {
return "", fmt.Errorf("path %q cannot be resolved within %q: %w", rel, cleanDir, err)
}
if out {
return "", fmt.Errorf("path %q escapes configured directory %q", rel, cleanDir)
}
// Repeat the check against the real targets. A symlink under cleanDir can
// point anywhere, so the name-level check above proves nothing on its own.
resolvedDir, err := ResolveSymlinks(cleanDir)
if err != nil {
return "", fmt.Errorf("directory %q cannot be resolved: %w", cleanDir, err)
}
resolvedDest, err := ResolveSymlinks(cleanDest)
if err != nil {
return "", fmt.Errorf("path %q cannot be resolved: %w", rel, err)
}
out, err = escapes(resolvedDir, resolvedDest)
if err != nil {
return "", fmt.Errorf("path %q cannot be resolved within %q: %w", rel, cleanDir, err)View on GitHub (pinned to 8cc6e09de2)
Solutions
- Verify both destination_dir and the object path use the same volume/root convention
- Simplify the relative path (no exotic components) and retry
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/tools/cloudstorage/cloudstoragecommon/paths.go:138 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/3be2b3475ae122c1.
Report an issue: GitHub.