apache/beam · error · IllegalStateException

No conversion exists from type

Error message

No conversion exists from type: {valueType} to Beam type.

What it means

convertValueToObject maps Datastore protobuf Value types to Java objects for Beam Rows. The switch handles KEY, BOOLEAN, INTEGER, DOUBLE, STRING, TIMESTAMP, ARRAY etc., but GEO_POINT_VALUE (and any unrecognized type) falls into the default branch and throws. Beam's EntityToRow simply has no conversion defined for GeoPoint values.

Solutions

  1. Avoid reading entities with GeoPoint properties, or filter those properties out before conversion
  2. Convert the GeoPoint yourself by extending/forking the converter: map GEO_POINT_VALUE to a ROW{lat: DOUBLE, lng: DOUBLE} or two DOUBLE fields
  3. Flatten GeoPoints into separate latitude/longitude properties in Datastore so no GEO_POINT_VALUE reaches the reader
  4. Upgrade to the latest Beam version in case new value-type conversions were added

Example fix

// before
case GEO_POINT_VALUE:
default:
  throw new IllegalStateException("No conversion exists from type: "
      + val.getValueTypeCase().name() + " to Beam type.");
// after
case GEO_POINT_VALUE:
  return Row.withSchema(GEO_POINT_SCHEMA)
      .addValues(val.getGeoPointValue().getLatitude(), val.getGeoPointValue().getLongitude())
      .build();
default:
  throw new IllegalStateException("No conversion exists from type: "
      + val.getValueTypeCase().name() + " to Beam type.");
Defensive patterns

Strategy: validation

Validate before calling

// Inspect entities before conversion and reject unsupported value types:
for (Map.Entry<String, Value> e : entity.getPropertiesMap()) {
  Value.TypeCase t = e.getValue().getValueTypeCase();
  if (t == Value.TypeCase.GEO_POINT_VALUE) {
    throw new IllegalArgumentException("Property " + e.getKey() + " is a GeoPoint; not convertible to Beam type");
  }
}

Type guard

boolean isConvertible(Value val) {
  switch (val.getValueTypeCase()) {
    case KEY_VALUE: case BOOLEAN_VALUE: case INTEGER_VALUE: case DOUBLE_VALUE:
    case STRING_VALUE: case TIMESTAMP_VALUE: case ARRAY_VALUE: case NULL_VALUE:
      return true;
    default:
      return false;
  }
}

Try / catch

try {
  row = extractRowFromProperties(entity.getPropertiesMap());
} catch (IllegalStateException e) {
  LOG.error("Unconvertible Datastore value in entity {}: {}", entity.getKey(), e.getMessage());
  throw e;
}

Prevention

When it happens

Trigger: Reading a Datastore Entity whose property is a GeoPoint (latLng value), or an entirely unknown/new Value type case, during convertValueToObject called from extractRowFromProperties.

Common situations: Datastore entities containing lat/long GeoPoint properties being read into Beam; a Datastore API version introducing value types this Beam converter predates; array elements (recursive call) containing GeoPoints.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

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

          return val.getKeyValue().toByteArray();
        case BLOB_VALUE:
          return val.getBlobValue().toByteArray();
        case ENTITY_VALUE:
          // Recursive mapping for row type.
          Schema rowSchema = currentFieldType.getRowSchema();
          assert rowSchema != null;
          Entity entity = val.getEntityValue();
          return extractRowFromProperties(rowSchema, entity.getPropertiesMap());
        case ARRAY_VALUE:
          // Recursive mapping for collection type.
          Schema.FieldType elementType = currentFieldType.getCollectionElementType();
          List<Value> valueList = val.getArrayValue().getValuesList();
          return valueList.stream()
              .map(v -> convertValueToObject(elementType, v))
              .collect(Collectors.toList());
        case GEO_POINT_VALUE:
        default:
          throw new IllegalStateException(
              "No conversion exists from type: "
                  + val.getValueTypeCase().name()
                  + " to Beam type.");
      }
    }

    /**
     * Converts all properties of an {@code Entity} to Beam {@code Row}.
     *
     * @param schema Target row {@code Schema}.
     * @param values A map of property names and values.
     * @return resulting Beam {@code Row}.
     */
    private Row extractRowFromProperties(Schema schema, Map<String, Value> values) {
      Row.Builder builder = Row.withSchema(schema);
      // It is not a guarantee that the values will be in the same order as the schema.
      // Maybe metadata:
      // https://cloud.google.com/appengine/docs/standard/python/datastore/metadataqueries

View on GitHub (pinned to 12126d8942)