{"record":{"id":"67c064af7a8a0774","repo":"googleapis/mcp-toolbox","slug":"error-fetching-connections-w","errorCode":null,"errorMessage":"error fetching connections: %w","messagePattern":"error fetching connections: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/looker/lookerhealthpulse/lookerhealthpulse.go","lineNumber":223,"sourceCode":"\n// Check DB connections and run tests\nfunc (t *pulseTool) checkDBConnections(ctx context.Context, source compatibleSource) (interface{}, error) {\n\tlogger, err := util.LoggerFromContext(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to get logger from ctx: %s\", err)\n\t}\n\tlogger.InfoContext(ctx, \"Test 1/6: Checking connections\")\n\n\treservedNames := map[string]struct{}{\n\t\t\"looker__internal__analytics__replica\": {},\n\t\t\"looker__internal__analytics\":          {},\n\t\t\"looker\":                               {},\n\t\t\"looker__ilooker\":                      {},\n\t}\n\n\tconnections, err := t.SdkClient.AllConnections(\"\", source.LookerApiSettings())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error fetching connections: %w\", err)\n\t}\n\n\tvar filteredConnections []v4.DBConnection\n\tfor _, c := range connections {\n\t\tif _, reserved := reservedNames[*c.Name]; !reserved {\n\t\t\tfilteredConnections = append(filteredConnections, c)\n\t\t}\n\t}\n\tif len(filteredConnections) == 0 {\n\t\treturn nil, fmt.Errorf(\"no connections found\")\n\t}\n\n\tvar results []map[string]interface{}\n\tfor _, conn := range filteredConnections {\n\t\tvar errors []string\n\t\t// Test connection (simulate test_connection endpoint)\n\t\tresp, err := t.SdkClient.TestConnection(*conn.Name, nil, source.LookerApiSettings())\n\t\tif err != nil {","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/looker/lookerhealthpulse/lookerhealthpulse.go#L205-L241","documentation":"The looker-health-pulse tool wraps Looker SDK errors while listing all database connections via AllConnections. This library throws it whenever the Looker API call to enumerate connections fails, preserving the underlying reason (auth, network, permissions) via %w wrapping. It is the first step of the health pulse run, so a failure here aborts the whole pulse before any checks execute.","triggerScenarios":"t.SdkClient.AllConnections(\"\", source.LookerApiSettings()) returns an error: invalid/expired Looker API credentials, network failure to the Looker instance, insufficient permissions for the API user, or the Looker instance being unreachable.","commonSituations":"Misconfigured client_id/client_secret on the looker source; Looker instance URL typo or firewall blocking egress; API user lacking permission to view connections; Looker (Google Cloud core) instances where connection management APIs differ; expired OAuth tokens.","solutions":["Verify the looker source credentials (base URL, client_id, client_secret) and test connectivity with curl to the Looker /connections API endpoint","Check the wrapped error message (%w) for the root cause — 401/403 means fix credentials/permissions, timeout/DNS means fix network","Ensure the API user has admin or at least view_connections permissions on the Looker instance","If running on Looker (Google Cloud core), confirm the connections listing API is supported for your instance type"],"exampleFix":"// before: opaque failure\nconnections, err := t.SdkClient.AllConnections(\"\", source.LookerApiSettings())\nif err != nil {\n\treturn nil, fmt.Errorf(\"error fetching connections: %w\", err)\n}\n// after: pre-validate client reachability\nif _, err := t.SdkClient.Me(source.LookerApiSettings()); err != nil {\n\treturn nil, fmt.Errorf(\"looker API unreachable or unauthorized: %w\", err)\n}\nconnections, err := t.SdkClient.AllConnections(\"\", source.LookerApiSettings())\nif err != nil {\n\treturn nil, fmt.Errorf(\"error fetching connections: %w\", err)\n}","handlingStrategy":"try-catch","validationCode":"// Go: verify Looker API connectivity before running the pulse\nif _, err := sdkClient.Me(settings); err != nil {\n\treturn fmt.Errorf(\"looker API unavailable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"connections, err := t.SdkClient.AllConnections(\"\", settings)\nif err != nil {\n\tvar apiErr *looker.GenericOpenAPIError\n\tif errors.As(err, &apiErr) {\n\t\tlog.Printf(\"looker API error: %s\", apiErr.Body())\n\t}\n\treturn fmt.Errorf(\"error fetching connections: %w\", err)\n}","preventionTips":["Validate looker source credentials at startup with a lightweight Me() call","Alert on Looker API 401/403 responses to catch credential rotation issues","Ensure network egress to the Looker instance is allowed from the toolbox host"],"tags":["looker","api","network","authentication"],"backgroundTag":"api-request-failed","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}