{"record":{"id":"a4c2a2ea6e194a63","repo":"googleapis/mcp-toolbox","slug":"failed-to-parse-project-number-q-as-int64-w","errorCode":null,"errorMessage":"failed to parse project number %q as int64: %w","messagePattern":"failed to parse project number %q as int64: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/dataplex/dataplex.go","lineNumber":116,"sourceCode":"\t\tprojectsClient.Close()\n\t\treturn nil, fmt.Errorf(\"failed to get project details for project %q: %w\", r.Project, err)\n\t}\n\tparts := strings.Split(proj.Name, \"/\")\n\tif len(parts) < 2 {\n\t\tclient.Close()\n\t\tdataScanClient.Close()\n\t\tdataProductClient.Close()\n\t\tprojectsClient.Close()\n\t\treturn nil, fmt.Errorf(\"unexpected project resource name format: %q\", proj.Name)\n\t}\n\tprojectNumberStr := parts[1]\n\tprojectNumber, err := strconv.ParseInt(projectNumberStr, 10, 64)\n\tif err != nil {\n\t\tclient.Close()\n\t\tdataScanClient.Close()\n\t\tdataProductClient.Close()\n\t\tprojectsClient.Close()\n\t\treturn nil, fmt.Errorf(\"failed to parse project number %q as int64: %w\", projectNumberStr, err)\n\t}\n\n\ts := &Source{\n\t\tConfig:            r,\n\t\tClient:            client,\n\t\tDataScanClient:    dataScanClient,\n\t\tdataProductClient: dataProductClient,\n\t\tprojectsClient:    projectsClient,\n\t\tprojectNumber:     projectNumber,\n\t}\n\n\treturn s, nil\n}\n\nvar _ sources.Source = &Source{}\n\ntype Source struct {\n\tConfig","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/dataplex/dataplex.go#L98-L134","documentation":"The source extracts the project number string from the second segment of the GetProject resource name and converts it with strconv.ParseInt. This error wraps a strconv failure when that segment is not a valid int64. Like the format error, it is a defensive guard against an unexpected Resource Manager response and is rare in practice.","triggerScenarios":"Initialize runs strconv.ParseInt(projectNumberStr, 10, 64) on parts[1] of proj.Name and the string is not a decimal integer (e.g. an alphanumeric project ID was returned instead of a numeric project number).","commonSituations":"Custom/mock Resource Manager endpoints returning the project ID rather than the number in the resource name; altered or proxied API responses; corrupted service responses.","solutions":["Confirm GetProject is hitting the real Google API (remove mocks/proxies that may return `projects/<project-id>` instead of `projects/<number>`).","Retry initialization to rule out a transient malformed response.","Update cloud.google.com/go/resourcemanager to the latest version and file an issue with Google if the real API returns a non-numeric second segment."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"src, err := cfg.Initialize(ctx, tracer)\nif err != nil {\n\tif strings.Contains(err.Error(), \"failed to parse project number\") {\n\t\tlog.Printf(\"unexpected project number from API; retrying: %v\", err)\n\t\treturn cfg.Initialize(ctx, tracer)\n\t}\n\treturn err\n}","preventionTips":["Do not route Resource Manager traffic through custom transforms/mocks.","Keep dependencies updated so GetProject returns the canonical `projects/<number>` name.","Treat recurrence as an upstream bug and report to the library maintainers."],"tags":["gcp","dataplex","parsing","strconv","initialization"],"backgroundTag":"unexpected-resource-name-format","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"}