apache/beam · error · InvalidLocationException

DataStoreV1 location must be set.

Error message

DataStoreV1 location must be set. 

What it means

DataStoreV1SchemaIOProvider.validateLocation requires a location string for the DataStoreV1 SchemaIO. If the location is null (missing) it throws InvalidLocationException "DataStoreV1 location must be set. ". The location identifies the target as 'projectId/kind'.

Solutions

  1. Supply a location in the form 'projectId/kind', e.g. my-project/my-kind.
  2. Check the pipeline parameter/variable feeding the location is actually populated.
  3. When using SchemaIO programmatically, pass the location string in the constructor/spec.

Example fix

// before
--location= 
// after
--location=my-gcp-project/MyEntityKind
Defensive patterns

Strategy: validation

Validate before calling

if (location == null || location.isEmpty()) {
  throw new IllegalArgumentException("DataStoreV1 SchemaIO requires a location of form 'projectId/kind'.");
}

Type guard

static boolean hasLocation(java.util.Map<String,Object> config) {
  Object loc = config.get("location");
  return loc instanceof String && !((String) loc).isEmpty();
}

Try / catch

try {
  SchemaIO io = new DataStoreV1SchemaIOProvider().fromValue(location);
} catch (InvalidLocationException e) {
  // location missing: abort pipeline startup with a clear user-facing message
}

Prevention

When it happens

Trigger: Creating the DataStoreV1 SchemaIO (e.g. beam:io:datastorev1:... location) without any location string, such as WriteTo/DataStoreV1 with an empty or null location parameter.

Common situations: Templated pipelines where the location parameter was not filled in; programmatic DataStoreV1SchemaIOProvider.fromValue(null); scripts dropping the location argument.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/87aa2dcfa7e941d9. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/datastore/DataStoreV1SchemaIOProvider.java:172

    public String getKind() {
      return kind;
    }

    private String determineKeyField(String configKey) {
      if (configKey != null && configKey.isEmpty()) {
        throw new InvalidConfigurationException(
            String.format("'%s' property cannot be null.", KEY_FIELD_PROPERTY));
      } else if (configKey != null) {
        return configKey;
      } else {
        return DEFAULT_KEY_FIELD;
      }
    }

    private void validateLocation(String location, Matcher matcher) {
      // TODO: allow users to specify a namespace in a location string.
      if (location == null) {
        throw new InvalidLocationException("DataStoreV1 location must be set. ");
      }
      if (!matcher.matches()) {
        throw new InvalidLocationException(
            "DataStoreV1 location must be in the following format: 'projectId/kind'"
                + " but was:"
                + location);
      }
    }
  }
}

View on GitHub (pinned to 12126d8942)