apache/beam · error · IOException
Unable to get project number
Error message
Unable to get project number
What it means
GcpOptions.getProjectNumber retries a Cloud Resource Manager projects.get call with backoff; any Exception is rethrown as IOException('Unable to get project number'). This is the low-level failure behind error 1032.
Source
Thrown at sdks/java/extensions/google-cloud-platform-core/src/main/java/org/apache/beam/sdk/extensions/gcp/options/GcpOptions.java:543
/**
* Returns the project number or throws an error if the project does not exist or has other
* access errors.
*/
private static long getProjectNumber(
String projectId, CloudResourceManager crmClient, BackOff backoff, Sleeper sleeper)
throws IOException {
CloudResourceManager.Projects.Get getProject = crmClient.projects().get(projectId);
try {
Project project =
ResilientOperation.retry(
getProject::execute,
backoff,
RetryDeterminer.SOCKET_ERRORS,
IOException.class,
sleeper);
return project.getProjectNumber();
} catch (Exception e) {
throw new IOException("Unable to get project number", e);
}
}
@VisibleForTesting
static String getRegionFromZone(String zone) {
String[] zoneParts = zone.split("-", -1);
checkArgument(zoneParts.length >= 2, "Invalid zone provided: %s", zone);
return zoneParts[0] + "-" + zoneParts[1];
}
/**
* Returns a CloudResourceManager client builder using the specified {@link
* CloudResourceManagerOptions}.
*/
@VisibleForTesting
static CloudResourceManager.Builder newCloudResourceManagerClient(
CloudResourceManagerOptions options) {
Credentials credentials = options.getGcpCredential();View on GitHub (pinned to 12126d8942)
Solutions
- Fix the underlying CRM access: correct project ID, resourcemanager.projects.get permission, API enabled
- Test with `gcloud projects describe <id>` from the same environment
- Check network/proxy allows googleapis.com; retry after transient outages
- Provide an explicit --tempLocation so project-number lookup is never needed
Example fix
// before // implicit default bucket -> getProjectNumber fails // after --tempLocation=gs://existing-bucket/temp/
Defensive patterns
Strategy: retry
Validate before calling
// validate project access before pipeline start gcloud projects describe $PROJECT_ID # or call CRM projects.get from the same credentials/network
Try / catch
try {
String bucket = gcpOptions.getDefaultBucketName();
} catch (IOException | RuntimeException e) {
if (e.getMessage() != null && (e.getMessage().contains("Unable to get project number") || e.getCause() instanceof IOException)) {
// exponential backoff retry, then fail with guidance
}
throw e;
} Prevention
- Confirm CRM API is enabled and IAM grants resourcemanager.projects.get
- Run `gcloud projects describe` in the same env/network as the pipeline
- Check proxy/firewall access to cloudresourcemanager.googleapis.com
- Set explicit --tempLocation to bypass the lookup entirely
When it happens
Trigger: getProjectNumber(projectId, crmClient) invoked from getDefaultBucketName; the CRM projects.get RPC fails repeatedly (403 permission denied, 404 not found, API disabled, network errors exhausting the RetryDeterminer.SOCKET_ERRORS backoff).
Common situations: Missing resourcemanager.projects.get; disabled Cloud Resource Manager API; wrong project ID; corporate proxy blocking googleapis.com; quota exhaustion.
Understand the failure class
Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.
Related errors
- Unable to verify project with ID ${projectId}
- Unable create default bucket.
- Unable to determine the owner of the default bucket at gs://
- Failed to retrieve secret bytes
- Failed to create subscription to topic %s on project %s: %s
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/70be06ac25c6b66a.
Report an issue: GitHub.