{"record":{"id":"f96f8d768b25cbe3","repo":"apache/iceberg","slug":"found-unsupported-view-representations-s","errorCode":null,"errorMessage":"Found unsupported view representations: %s","messagePattern":"Found unsupported view representations: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java","lineNumber":699,"sourceCode":"    request.validate();\n\n    ViewBuilder viewBuilder =\n        catalog\n            .buildView(TableIdentifier.of(namespace, request.name()))\n            .withSchema(request.schema())\n            .withProperties(request.properties())\n            .withDefaultNamespace(request.viewVersion().defaultNamespace())\n            .withDefaultCatalog(request.viewVersion().defaultCatalog())\n            .withLocation(request.location());\n\n    Set<String> unsupportedRepresentations =\n        request.viewVersion().representations().stream()\n            .filter(r -> !(r instanceof SQLViewRepresentation))\n            .map(ViewRepresentation::type)\n            .collect(Collectors.toSet());\n\n    if (!unsupportedRepresentations.isEmpty()) {\n      throw new IllegalStateException(\n          String.format(\"Found unsupported view representations: %s\", unsupportedRepresentations));\n    }\n\n    request.viewVersion().representations().stream()\n        .filter(SQLViewRepresentation.class::isInstance)\n        .map(SQLViewRepresentation.class::cast)\n        .forEach(r -> viewBuilder.withQuery(r.dialect(), r.sql()));\n\n    View view = viewBuilder.create();\n\n    return viewResponse(view);\n  }\n\n  private static LoadViewResponse viewResponse(View view) {\n    ViewMetadata metadata = asBaseView(view).operations().current();\n    return ImmutableLoadViewResponse.builder()\n        .metadata(metadata)\n        .metadataLocation(metadata.metadataFileLocation())","sourceCodeStart":681,"sourceCodeEnd":717,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java#L681-L717","documentation":"When creating a view via the REST API, all view version representations must be SQL representations (SQLViewRepresentation); if the request carries a representation of any other type, the handler throws IllegalStateException listing the unsupported representation types, since the server cannot store or interpret them.","triggerScenarios":"POST /v1/{prefix}/namespaces/{ns}/views with a CreateViewRequest whose viewVersion.representations() contains a non-SQL representation type (e.g. a representation introduced by a newer spec/extension or a client bug serializing the wrong type).","commonSituations":"Newer client SDK sending representation types an older server does not know; custom engines emitting non-SQL view representations; corrupted or hand-built CreateViewRequest JSON.","solutions":["Send only SQL view representations (SqlViewRepresentation with sql and dialect) in the request","Upgrade the REST server to a version that supports the representation type being sent","Inspect the CreateViewRequest payload and remove/convert unknown representation entries"],"exampleFix":"// before\nViewRepresentation rep = new MyCustomRepresentation(...); // non-SQL\n// after\nSQLViewRepresentation rep = new SQLViewRepresentation(\"SELECT * FROM t\", \"spark\");","handlingStrategy":"validation","validationCode":"boolean allSql = request.viewVersion().representations().stream()\n    .allMatch(r -> r instanceof SQLViewRepresentation);\nif (!allSql) throw new IllegalArgumentException(\"Only SQL view representations are supported\");","typeGuard":"function isSqlRepresentation(r) { return r instanceof org.apache.iceberg.view.SQLViewRepresentation; }","tryCatchPattern":"try {\n  resp = CatalogHandlers.createView(catalog, ns, request);\n} catch (IllegalStateException e) {\n  // inspect e.getMessage() for the unsupported representation types\n}","preventionTips":["Build CreateViewRequest only with SQLViewRepresentation entries","Keep client and server REST view spec versions in sync","Validate view request payloads before sending to the server"],"tags":["rest-catalog","view","representations","unsupported"],"backgroundTag":"unsupported-operation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}