googleapis/mcp-toolbox · error
failed to get project details for project %q: %w
Error message
failed to get project details for project %q: %w
What it means
During Dataplex source initialization, the source resolves the configured project ID to its project resource via the Cloud Resource Manager GetProject API. This error wraps any failure from that RPC, with all four already-created clients (Catalog, DataScan, DataProduct, Projects) closed first. It indicates the project could not be fetched, most often because it does not exist or the caller lacks permission to view it.
Source
Thrown at internal/sources/dataplex/dataplex.go:99
}
func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) {
// Initializes a Dataplex source
client, dataScanClient, dataProductClient, projectsClient, err := initDataplexConnection(ctx, tracer, r.Name, r.Project, r.ImpersonateServiceAccount, r.Scopes)
if err != nil {
return nil, err
}
// Resolve project number
proj, err := projectsClient.GetProject(ctx, &resourcemanagerpb.GetProjectRequest{
Name: "projects/" + r.Project,
})
if err != nil {
client.Close()
dataScanClient.Close()
dataProductClient.Close()
projectsClient.Close()
return nil, fmt.Errorf("failed to get project details for project %q: %w", r.Project, err)
}
parts := strings.Split(proj.Name, "/")
if len(parts) < 2 {
client.Close()
dataScanClient.Close()
dataProductClient.Close()
projectsClient.Close()
return nil, fmt.Errorf("unexpected project resource name format: %q", proj.Name)
}
projectNumberStr := parts[1]
projectNumber, err := strconv.ParseInt(projectNumberStr, 10, 64)
if err != nil {
client.Close()
dataScanClient.Close()
dataProductClient.Close()
projectsClient.Close()
return nil, fmt.Errorf("failed to parse project number %q as int64: %w", projectNumberStr, err)
}View on GitHub (pinned to 8cc6e09de2)
Solutions
- Verify the project ID in the source config with `gcloud projects describe <project>` — fix typos.
- Authenticate with an account that can view the project: `gcloud auth application-default login` as a member with roles/viewer (or resourcemanager.projects.get).
- If using service account impersonation, confirm the target SA has Viewer on the project and you have roles/iam.serviceAccountTokenCreator on it.
- Confirm the project exists and is active (not deleted/suspended) in the Cloud Console.
- Check network/proxy connectivity to cloudresourcemanager.googleapis.com.
Example fix
// before
sources:
my-dataplex:
type: dataplex
project: my-projec-id
// after
sources:
my-dataplex:
type: dataplex
project: my-project-id Defensive patterns
Strategy: validation
Validate before calling
gcloud projects describe $PROJECT_ID >/dev/null && echo ok || echo 'project missing or inaccessible'
Try / catch
src, err := cfg.Initialize(ctx, tracer)
if err != nil {
if strings.Contains(err.Error(), "failed to get project details") {
log.Fatalf("check project ID and IAM permissions: %v", err)
}
return err
} Prevention
- Validate the project ID with `gcloud projects describe` before starting the toolbox.
- Grant the runtime identity roles/viewer (or resourcemanager.projects.get) on the target project.
- Keep project ID (not number) in the config and copy it from `gcloud config get-value project`.
- Authenticate before launch: `gcloud auth application-default login`.
When it happens
Trigger: Config.Initialize calls projectsClient.GetProject(ctx, {Name: "projects/<project>"}) and the RPC returns an error: nonexistent project, typo'd project ID, disabled project, or caller lacking resourcemanager.projects.get / Viewer role.
Common situations: Typo in the `project` field of the toolbox YAML; using a project number where an ID is expected (or vice versa); ADC pointing to an account in a different org without access; running locally without gcloud auth application-default login; project recently deleted or billing disabled.
Related errors
- unexpected project resource name format: %q
- failed to parse project number %q as int64: %w
- failed to find default Google Cloud credentials for project
- failed to create Dataplex client for project %q: %w
- failed to create Dataplex DataScan client for project %q: %w
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/87316628aa2d5f93.
Report an issue: GitHub.