apache/beam · error · IllegalStateException

No conversion exists from type

Error message

No conversion exists from type: {valueClass} to DataStove Value.

What it means

RowToEntity.mapObjectToValue maps Beam Row field Java types (String, Integer, Long, Double, Boolean, ByteArray, timestamps, nested Rows, collections, etc.) to datastore Value types. If the object's runtime class has no mapping, an IllegalStateException is thrown stating no conversion exists (note the 'DataStove' typo). It is a coding/schema error, not a data error.

Solutions

  1. Change the field type in the Beam Schema/Row to one of the supported types (String, Integer, Long, Double, Boolean, byte[], Instant, Row, Collection)
  2. Convert unsupported values (e.g. BigDecimal) to String or Double before building the Row
  3. Write a custom DoFn to Datastore Value mapping instead of RowToEntity if exotic types are required
  4. Check the Beam SDK version for added type support and upgrade if a needed mapping exists upstream

Example fix

// before
row.of(row.getBigDecimal("amount")) // no conversion for BigDecimal
// after
row.of(row.getBigDecimal("amount").doubleValue()) // or .toPlainString()
Defensive patterns

Strategy: type-guard

Validate before calling

Object v = row.getValue(field);
if (!(v instanceof String || v instanceof Integer || v instanceof Long || v instanceof Double
    || v instanceof Boolean || v instanceof byte[] || v instanceof Instant || v instanceof Row
    || v instanceof Collection)) {
  throw new IllegalArgumentException("Unsupported type for Datastore value: " + v.getClass());
}

Type guard

boolean isDatastoreConvertible(Object v) {
  return v instanceof String || v instanceof Integer || v instanceof Long || v instanceof Double
      || v instanceof Boolean || v instanceof byte[] || v instanceof Instant
      || v instanceof Row || v instanceof Collection;
}

Try / catch

try {
  entity = rowToEntityFn.convert(row);
} catch (IllegalStateException e) {
  LOG.error("Field type not convertible to Datastore Value", e); // fix schema or convert value
}

Prevention

When it happens

Trigger: A Beam Row field contains a Java type not in RowToEntity's instanceof ladder — e.g. a BigDecimal, a custom POJO, java.sql.Timestamp, or an unsupported numeric/wrapper type — and that field is converted to a Datastore entity value.

Common situations: Schema evolution adding a field with a logical type RowToEntity doesn't support; passing a raw Map (not converted to Row) or BigDecimal into the row; newer Beam SDK field types on an older conversion path.

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/fefad399da78c950. Report an issue: GitHub.

Appendix: source

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

        return makeValue((Float) value).build();
      } else if (String.class.equals(value.getClass())) {
        return makeValue((String) value).build();
      } else if (Instant.class.equals(value.getClass())) {
        return makeValue(((Instant) value).toDate()).build();
      } else if (byte[].class.equals(value.getClass())) {
        return makeValue(ByteString.copyFrom((byte[]) value)).build();
      } else if (value instanceof Row) {
        // Recursive conversion to handle nested rows.
        Row row = (Row) value;
        return makeValue(constructEntityFromRow(row.getSchema(), row)).build();
      } else if (value instanceof Collection) {
        // Recursive to handle nested collections.
        Collection<Object> collection = (Collection<Object>) value;
        List<Value> arrayValues =
            collection.stream().map(this::mapObjectToValue).collect(Collectors.toList());
        return makeValue(arrayValues).build();
      }
      throw new IllegalStateException(
          "No conversion exists from type: " + value.getClass() + " to DataStove Value.");
    }
  }
}

View on GitHub (pinned to 12126d8942)