googleapis/mcp-toolbox · error
looker API response or its fields object is nil
Error message
looker API response or its fields object is nil
What it means
CheckLookerExploreFields is a nil-guard for the Looker API explore response: it verifies the LookmlModelExplore and its Fields object are non-nil before field extraction, because the Looker SDK can return partial responses where Fields is absent.
Source
Thrown at internal/tools/looker/lookercommon/lookercommon.go:105
if v.Suggestions != nil && len(*v.Suggestions) > 0 {
vMap["suggestions"] = *v.Suggestions
}
if v.SuggestExplore != nil && v.SuggestDimension != nil {
vMap["suggest_explore"] = *v.SuggestExplore
vMap["suggest_dimension"] = *v.SuggestDimension
}
}
logger.DebugContext(ctx, "Converted to %v\n", vMap)
data = append(data, vMap)
}
return data, nil
}
// CheckLookerExploreFields checks if the Fields object in LookmlModelExplore is nil before accessing its sub-fields.
func CheckLookerExploreFields(resp *v4.LookmlModelExplore) error {
if resp == nil || resp.Fields == nil {
return fmt.Errorf("looker API response or its fields object is nil")
}
return nil
}
func GetFieldParameters() parameters.Parameters {
modelParameter := parameters.NewStringParameter("model", "The model containing the explore.")
exploreParameter := parameters.NewStringParameter("explore", "The explore containing the fields.")
return parameters.Parameters{modelParameter, exploreParameter}
}
func GetQueryParameters() parameters.Parameters {
modelParameter := parameters.NewStringParameter("model", "The model containing the explore.")
exploreParameter := parameters.NewStringParameter("explore", "The explore to be queried.")
fieldsParameter := parameters.NewArrayParameter("fields",
"The fields to be retrieved.",
parameters.NewStringParameter("field", "A field to be returned in the query"),
)
filtersParameter := parameters.NewMapParameter(View on GitHub (pinned to 8cc6e09de2)
Solutions
- Verify the 'model' and 'explore' parameters match real explores in your Looker instance.
- Check the Looker API credentials and permissions grant access to the explore.
- Log/inspect the raw response to see why Fields was nil before retrying.
Example fix
// before
explore, _ := sdk.GetLookmlModelExplore(ctx, model, exploreName)
lookercommon.CheckLookerExploreFields(explore)
// after
explore, err := sdk.GetLookmlModelExplore(ctx, model, exploreName)
if err != nil { return err }
if err := lookercommon.CheckLookerExploreFields(explore); err != nil {
return fmt.Errorf("explore %s/%s unavailable: %w", model, exploreName, err)
}
Defensive patterns
Strategy: type-guard
Validate before calling
if explore == nil || explore.Fields == nil {
return fmt.Errorf("explore response incomplete")
}
// then call CheckLookerExploreFields Type guard
func hasExploreFields(resp *v4.LookmlModelExplore) bool {
return resp != nil && resp.Fields != nil
} Try / catch
if err := lookercommon.CheckLookerExploreFields(resp); err != nil {
// surface which model/explore failed and stop field extraction
return fmt.Errorf("explore %s/%s: %w", model, exploreName, err)
} Prevention
- Validate model/explore names against your Looker instance before invoking.
- Check API errors from GetExplore before inspecting the response struct.
- Ensure the Looker service account has access to the requested explore.
When it happens
Trigger: Looker's GetExplore/lookml explore API returns a response whose Fields pointer is nil (explore not found, empty model, or API returning a stub object), then the tool calls this check before accessing resp.Fields.
Common situations: Querying a non-existent explore name/model; Looker instance returning malformed/partial data; SDK version changes altering response population; unauthenticated/limited-access explores.
Related errors
- empty web_server_url in versions payload
- job has no placement info
- unable to get logger from ctx: %s
- unable to parse Timeout string as time.Duration: %s
- client_id and client_secret need to be specified
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/7e9c56206e37f76a.
Report an issue: GitHub.