OpenRefine/OpenRefine · error · java.lang.IllegalStateException

Unsupported entity type

Error message

Unsupported entity type

What it means

SchemaPropertyExtractor.getAllProperties extracts property IDs from a schema's entity document expressions, but it only handles WbItemEditExpr and WbMediaInfoEditExpr; any other expression type throws IllegalStateException 'Unsupported entity type'. The QA scrutinizer pipeline relies on this to know which properties to fetch from the entity cache.

Solutions

  1. Run QA only on schemas editing Items or MediaInfo entities, or add a branch for the missing expression type (e.g. WbPropertyEditExpr/WbLexemeEditExpr) in SchemaPropertyExtractor.
  2. Check which entity type your manifest/schema targets and switch to an OpenRefine version that supports it.
  3. Catch the IllegalStateException in custom QA tooling and skip property extraction for unsupported entity types.
  4. File/verify an upstream issue for the entity type you need if it is a legitimate new type.

Example fix

// before: extractor chokes on new entity types
} else if (entityDocumentExpr instanceof WbMediaInfoEditExpr) {
    statementGroups = ((WbMediaInfoEditExpr) entityDocumentExpr).getStatementGroups();
} else {
    throw new IllegalStateException("Unsupported entity type");
}

// after: extend coverage
} else if (entityDocumentExpr instanceof WbMediaInfoEditExpr) {
    statementGroups = ((WbMediaInfoEditExpr) entityDocumentExpr).getStatementGroups();
} else if (entityDocumentExpr instanceof WbPropertyEditExpr) {
    statementGroups = ((WbPropertyEditExpr) entityDocumentExpr).getStatementGroups();
} else {
    throw new IllegalStateException("Unsupported entity type");
}
Defensive patterns

Strategy: validation

Validate before calling

boolean supported = schema.getEntityDocumentExpr() instanceof WbItemEditExpr
    || schema.getEntityDocumentExpr() instanceof WbMediaInfoEditExpr;
if (!supported) { /* skip property extraction / QA for this entity type */ }

Type guard

if (!(expr instanceof WbItemEditExpr) && !(expr instanceof WbMediaInfoEditExpr)) {
    // unsupported entity type: skip QA property extraction
}

Try / catch

try {
    editInspector.inspect(editBatch);
} catch (ExecutionException e) {
    if (e.getCause() instanceof IllegalStateException
            && "Unsupported entity type".equals(e.getCause().getMessage())) {
        logger.warn("QA property extraction not supported for this entity type; skipping");
    } else throw e;
}

Prevention

When it happens

Trigger: Running QA inspection (EditInspector -> properties()/propertyIdValues() -> getAllProperties) on a schema whose top-level expression is neither a WbItemEditExpr nor a WbMediaInfoEditExpr — e.g. a WbItemEditExpr variant for entity types like Property or Lexeme not covered by the extractor.

Common situations: Editing Wikibase Properties or Lexemes (not Items/MediaInfo) and running the QA check; using a manifest for a Wikibase whose primary entity type is unsupported by the extractor; older OpenRefine versions lacking support for newer entity types.

Related errors


AI-assisted analysis of OpenRefine/OpenRefine@a946177e04 (2026-09-08). Data as JSON: /api/errors/776e8839cb57cb45. Report an issue: GitHub.

Appendix: source

Thrown at extensions/wikibase/src/org/openrefine/wikibase/qa/SchemaPropertyExtractor.java:36

import org.openrefine.wikibase.schema.WbSnakExpr;
import org.openrefine.wikibase.schema.WbStatementExpr;
import org.openrefine.wikibase.schema.WbStatementGroupExpr;
import org.openrefine.wikibase.schema.WikibaseSchema;
import org.openrefine.wikibase.updates.EntityEdit;

public class SchemaPropertyExtractor {

    public Set<PropertyIdValue> getAllProperties(WikibaseSchema schema) {
        Set<PropertyIdValue> properties = new HashSet<>();
        List<WbExpression<? extends EntityEdit>> entityDocumentExprs = schema.getEntityDocumentExpressions();
        for (WbExpression<? extends EntityEdit> entityDocumentExpr : entityDocumentExprs) {
            List<WbStatementGroupExpr> statementGroups = Collections.emptyList();
            if (entityDocumentExpr instanceof WbItemEditExpr) {
                statementGroups = ((WbItemEditExpr) entityDocumentExpr).getStatementGroups();
            } else if (entityDocumentExpr instanceof WbMediaInfoEditExpr) {
                statementGroups = ((WbMediaInfoEditExpr) entityDocumentExpr).getStatementGroups();
            } else {
                throw new IllegalStateException("Unsupported entity type");
            }
            for (WbStatementGroupExpr statementGroup : statementGroups) {
                WbExpression<? extends PropertyIdValue> statementGroupProperty = statementGroup.getProperty();
                if (statementGroupProperty instanceof WbPropConstant) {
                    properties.add(Datamodel.makeWikidataPropertyIdValue(((WbPropConstant) statementGroupProperty).getPid()));
                }
                List<WbStatementExpr> statementExprs = statementGroup.getStatements();
                for (WbStatementExpr statementExpr : statementExprs) {
                    List<WbSnakExpr> snakExprs = new ArrayList<>(statementExpr.getQualifiers());
                    List<WbReferenceExpr> referenceExprs = statementExpr.getReferences();
                    for (WbReferenceExpr referenceExpr : referenceExprs) {
                        snakExprs.addAll(referenceExpr.getSnaks());
                    }

                    for (WbSnakExpr snakExpr : snakExprs) {
                        WbExpression<? extends PropertyIdValue> qualifierProperty = snakExpr.getProp();
                        if (qualifierProperty instanceof WbPropConstant) {
                            properties.add(Datamodel.makeWikidataPropertyIdValue(((WbPropConstant) qualifierProperty).getPid()));

View on GitHub (pinned to a946177e04)