apache/beam · warning
unable to get Spanner instanceConfigId for {}
Error message
unable to get Spanner instanceConfigId for {} What it means
While creating the Spanner client, SpannerAccessor tries to fetch the instance's instanceConfigId for informational/validation purposes. Any exception during that lookup is swallowed and only logged as a warning (and suppressed entirely when a custom ServiceFactory is set, e.g. in tests). The SpannerAccessor is still returned; instanceConfigId may be null, which typically only matters for features that inspect the instance config (e.g. multi-region handling).
Source
Thrown at sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/SpannerAccessor.java:354
String databaseId = spannerConfig.getDatabaseId().get();
DatabaseClient databaseClient =
spanner.getDatabaseClient(DatabaseId.of(options.getProjectId(), instanceId, databaseId));
BatchClient batchClient =
spanner.getBatchClient(DatabaseId.of(options.getProjectId(), instanceId, databaseId));
DatabaseAdminClient databaseAdminClient = spanner.getDatabaseAdminClient();
String instanceConfigId = "unknown";
try {
instanceConfigId =
spanner
.getInstanceAdminClient()
.getInstance(instanceId)
.getInstanceConfigId()
.getInstanceConfig();
} catch (Exception e) {
// fetch instanceConfigId is fail-free.
// Do not emit warning when serviceFactory is overridden (e.g. in tests).
if (spannerConfig.getServiceFactory() == null) {
LOG.warn("unable to get Spanner instanceConfigId for {}", instanceId, e);
}
}
return new SpannerAccessor(
spanner, databaseClient, databaseAdminClient, batchClient, spannerConfig, instanceConfigId);
}
public DatabaseClient getDatabaseClient() {
return databaseClient;
}
public BatchClient getBatchClient() {
return batchClient;
}
public DatabaseAdminClient getDatabaseAdminClient() {
return databaseAdminClient;
}View on GitHub (pinned to 12126d8942)
Solutions
- Verify the instanceId in SpannerConfig matches an existing Cloud Spanner instance (check in the GCP console or via gcloud spanner instances list).
- Grant the service account the Cloud Spanner Viewer (or Admin) role so it can read instance metadata.
- Check that the Spanner Admin API is enabled and reachable from your environment.
- Inspect the exception attached to this warning for the root cause.
Example fix
// before
SpannerConfig config = SpannerConfig.create()
.withInstanceId("my-instnace") // typo
// after
SpannerConfig config = SpannerConfig.create()
.withInstanceId("my-instance") Defensive patterns
Strategy: validation
Validate before calling
// Before submitting the pipeline, verify the instance exists and is readable: gcloud spanner instances describe my-instance --project=my-project
Try / catch
// No exception escapes; the warning is swallowed. Detect degraded setup by asserting on the built accessor's config:
if (spannerConfig.getInstanceId() == null) {
throw new IllegalArgumentException("Spanner instanceId must be set");
} Prevention
- Verify instanceId/databaseId/projectId in SpannerConfig against gcloud before running.
- Grant the pipeline's service account spanner.instances.get (Cloud Spanner Viewer or higher).
- Enable the Cloud Spanner Admin API in the project.
When it happens
Trigger: spannerConfig.getServiceFactory() == null and the call spanner.getInstanceAdminClient().getInstance(instanceId).getInstanceConfigId().getInstanceConfig() throws — most commonly InstanceNotFoundException when the instanceId does not exist, or permission/API errors fetching the instance config.
Common situations: Typo in the Spanner instance ID in SpannerIO.read/write config; the Cloud Spanner admin API is disabled or blocked by network/VPC config; the service account lacks spanner.instances.get permission.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Unable to obtain credential
- Error constructing default value for gcpTempLocation: tempLo
- Unable to verify project with ID ${projectId}
- Unable create default bucket.
- Unable to determine the owner of the default bucket at gs://
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/6cb63fba0a9d074c.
Report an issue: GitHub.