googleapis/mcp-toolbox · error
all resources must belong to the same location. Please make
Error message
all resources must belong to the same location. Please make separate calls for each distinct location
What it means
dataplex-lookup-context resolves all resources in one Dataplex API call, so every resource must share the same location. Invoke takes the location of the first resource and fails if any subsequent resource's location segment differs, instructing the caller to split the request per location.
Source
Thrown at internal/tools/dataplex/dataplexlookupcontext/dataplexlookupcontext.go:140
err := fmt.Errorf("resources cannot be empty")
return nil, util.NewAgentError(err.Error(), err)
}
var name string
var firstLocation string
for i, resource := range resources {
parts := strings.Split(resource, "/")
if len(parts) < 4 || parts[0] != "projects" || parts[2] != "locations" {
err := fmt.Errorf("invalid resource format at index %d, must be in the format of projects/{project_id_or_number}/locations/{location}/entryGroups/{group}/entries/{entry}", i)
return nil, util.NewAgentError(err.Error(), err)
}
location := parts[3]
if i == 0 {
firstLocation = location
project := source.ProjectID()
name = fmt.Sprintf("projects/%s/locations/%s", project, location)
} else if location != firstLocation {
err := fmt.Errorf("all resources must belong to the same location. Please make separate calls for each distinct location")
return nil, util.NewAgentError(err.Error(), err)
}
}
resp, err := source.LookupContext(ctx, name, resources)
if err != nil {
return nil, util.ProcessGcpError(err)
}
return resp, nil
}
View on GitHub (pinned to 8cc6e09de2)
Solutions
- Group resources by location and issue one dataplex-lookup-context call per location
- Filter the input resources to a single location before invoking
- Use location from prior search results to bucket the entries client-side
Example fix
// before
{"resources": ["projects/p/locations/us-central1/entryGroups/g/entries/e1", "projects/p/locations/eu/entryGroups/g/entries/e2"]}
// after
{"resources": ["projects/p/locations/us-central1/entryGroups/g/entries/e1"]} // separate call for eu Defensive patterns
Strategy: validation
Validate before calling
func locationOf(r string) string {
parts := strings.Split(r, "/")
if len(parts) >= 4 && parts[0] == "projects" && parts[2] == "locations" {
return parts[3]
}
return ""
}
locs := map[string]bool{}
for _, r := range resources {
locs[locationOf(r)] = true
}
if len(locs) > 1 {
return fmt.Errorf("split resources by location before calling lookup-context")
} Try / catch
_, terr := tool.Invoke(ctx, src, params, token)
if terr != nil && strings.Contains(terr.Error(), "same location") {
// regroup resources per location and issue one call per group
} Prevention
- Group resources by location before batch lookups
- Never mix regions/locations in a single lookup-context call
- Persist the location alongside search results for later lookups
When it happens
Trigger: resources array contains entries from two or more GCP locations (e.g. one in us-central1 and another in eu-west1).
Common situations: An agent batches lookup requests across regions to save calls; search results spanning multiple locations are passed through unfiltered.
Related errors
- resources cannot be empty
- invalid resource format at index %d, must be in the format o
- invalid entry format: must be in the form projects/{project}
- --name is required unless --group or --toolset is set, or ex
- invalid ipType %s
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/d411e88c16f3b422.
Report an issue: GitHub.