{"record":{"id":"84ae608c0abe0f32","repo":"googleapis/mcp-toolbox","slug":"failed-to-list-data-scans-w","errorCode":null,"errorMessage":"failed to list data scans: %w","messagePattern":"failed to list data scans: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/dataplex/dataplex.go","lineNumber":416,"sourceCode":"\t\tParent:   fmt.Sprintf(\"projects/%s/locations/-\", s.ProjectID()),\n\t\tFilter:   filter,\n\t\tPageSize: int32(pageSize),\n\t\tOrderBy:  orderBy,\n\t}\n\n\tit := s.GetDataScanClient().ListDataScans(ctx, req)\n\n\tvar results []*dataplexpb.DataScan\n\tfor len(results) < pageSize {\n\t\tscan, err := it.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tif st, ok := grpcstatus.FromError(err); ok {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to list data scans: code=%s message=%s\", st.Code(), st.Message())\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"failed to list data scans: %w\", err)\n\t\t}\n\t\tresults = append(results, scan)\n\t}\n\treturn results, nil\n}\n\ntype DataProductSummary struct {\n\tLocationID    string   `json:\"locationId\"`\n\tDataProductID string   `json:\"dataProductId\"`\n\tDisplayName   string   `json:\"displayName\"`\n\tOwnerEmails   []string `json:\"ownerEmails\"`\n\tAssetCount    int32    `json:\"assetCount\"`\n}\n\nfunc (s *Source) ListDataProducts(\n\tctx context.Context,\n\tfilter string,\n\tpageSize int,","sourceCodeStart":398,"sourceCodeEnd":434,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/dataplex/dataplex.go#L398-L434","documentation":"This error wraps an unknown (non-gRPC-status) failure returned while iterating Dataplex DataScan results in SearchDataQualityScans. The library first checks whether the error carries a gRPC status; if it does not (e.g. a client-side, context, or transport-level error), it falls back to %w wrapping so the underlying cause is preserved. It means the scan listing operation could not complete for a reason the Dataplex API did not report as a structured status.","triggerScenarios":"Calling SearchDataQualityScans when iterator.Next() returns a non-gRPC error: a cancelled or deadline-exceeded context that surfaces as a plain context error, a network disconnect producing a wrapped transport error, or a client construction/serialization failure inside the paging loop.","commonSituations":"Short-lived HTTP clients losing connectivity mid-pagination; callers passing a context that is cancelled while iterating many pages; proxy or firewall dropping the long-lived gRPC/HTTP stream; go-auth library token refresh failures surfaced as plain errors.","solutions":["Inspect the wrapped cause with errors.Is/errors.Unwrap to identify the underlying transport, context, or auth error.","Check that the context passed to SearchDataQualityScans is not cancelled or near its deadline before/during pagination.","Verify network connectivity to the Dataplex endpoint (dataplex.googleapis.com:443) and retry the call.","Regenerate/refresh Application Default Credentials and retry in case of transient auth refresh failure."],"exampleFix":"// before\nctx := context.Background()\nscans, err := src.SearchDataQualityScans(ctx, ...)\n// after\nctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)\ndefer cancel()\nscans, err := src.SearchDataQualityScans(ctx, ...)\nif err != nil {\n\tif errors.Is(err, context.DeadlineExceeded) { /* retry with larger timeout */ }\n}","handlingStrategy":"try-catch","validationCode":"if err := ctx.Err(); err != nil { return nil, fmt.Errorf(\"context already done: %w\", err) }","typeGuard":"func asGRPCStatus(err error) (code string, msg string, ok bool) {\n\tif st, ok := status.FromError(err); ok {\n\t\treturn st.Code().String(), st.Message(), true\n\t}\n\treturn \"\", \"\", false\n}","tryCatchPattern":"scans, err := src.SearchDataQualityScans(ctx, query, pageSize)\nif err != nil {\n\tvar ctxErr error\n\tswitch {\n\tcase errors.Is(err, context.Canceled), errors.Is(err, context.DeadlineExceeded):\n\t\tctxErr = err // retry with fresh context\n\tdefault:\n\t\treturn fmt.Errorf(\"scan search failed: %w\", err)\n\t}\n\t_ = ctxErr\n}","preventionTips":["Always pass a context with an adequate timeout for paginated list calls.","Check ctx.Err() before starting long iterations.","Retry transient network errors with exponential backoff.","Keep credentials refreshed to avoid token-refresh failures mid-call."],"tags":["gcp","dataplex","grpc","network","pagination"],"backgroundTag":"grpc-transport-error","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"}