{"record":{"id":"77d49f3017391582","repo":"googleapis/mcp-toolbox","slug":"exceeded-max-retries-waiting-for-operation","errorCode":null,"errorMessage":"exceeded max retries waiting for operation","messagePattern":"exceeded max retries waiting for operation","errorType":"http","errorClass":"ClientServerError","httpStatus":504,"severity":"error","filePath":"internal/tools/cloudsql/cloudsqlwaitforoperation/cloudsqlwaitforoperation.go","lineNumber":252,"sourceCode":"\t\t\treturn nil, util.NewClientServerError(\"timed out waiting for operation\", http.StatusRequestTimeout, ctx.Err())\n\t\tdefault:\n\t\t}\n\n\t\top, err := source.GetWaitForOperations(ctx, service, project, operationID, cloudSQLConnectionMessageTemplate, delay)\n\t\tif err != nil {\n\t\t\treturn nil, util.ProcessGcpError(err)\n\t\t} else if op != nil {\n\t\t\treturn op, nil\n\t\t}\n\n\t\ttime.Sleep(delay)\n\t\tdelay = time.Duration(float64(delay) * multiplier)\n\t\tif delay > maxDelay {\n\t\t\tdelay = maxDelay\n\t\t}\n\t\tretries++\n\t}\n\treturn nil, util.NewClientServerError(\"exceeded max retries waiting for operation\", http.StatusGatewayTimeout, fmt.Errorf(\"exceeded max retries\"))\n}\n\n// Authorized checks if the tool is authorized.\nfunc (t Tool) Authorized(verifiedAuthServices []string) bool {\n\treturn true\n}\n\nfunc (t Tool) RequiresClientAuthorization(source sources.Source) (bool, error) {\n\ts, ok := source.(compatibleSource)\n\tif !ok {\n\t\treturn false, fmt.Errorf(\"invalid source for %q tool: source %q is not a compatible type\", t.Cfg.Type, t.Cfg.Source)\n\t}\n\treturn s.UseClientAuthorization(), nil\n}\n\n// buildParams builds the tool's parameters. A non-empty project means the source has a\n// configured default project, which is baked into the project param; otherwise the plain form is used.\nfunc buildParams(project string) parameters.Parameters {","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/cloudsql/cloudsqlwaitforoperation/cloudsqlwaitforoperation.go#L234-L270","documentation":"The polling loop in Invoke exhausted its configured maxRetries while the Cloud SQL operation was still not done — the operation is taking longer than delay/maxDelay/multiplier/maxRetries allow, and the tool returns a 504 Gateway Timeout.","triggerScenarios":"Thrown at internal/tools/cloudsql/cloudsqlwaitforoperation/cloudsqlwaitforoperation.go:252 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Increase maxRetries or maxDelay for long-running operations","Check the operation's progress in the Cloud SQL console for blockers","Retry the tool invocation to continue waiting"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}