{"record":{"id":"de078ecef98f1408","repo":"quarkusio/quarkus","slug":"update-types-are-only-supported-in-mongodb-context","errorCode":null,"errorMessage":"Update types are only supported in MongoDB contexts","messagePattern":"Update types are only supported in MongoDB contexts","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/TypeBundle.java","lineNumber":25,"sourceCode":"\n    default ByteCodeType entityCompanion() {\n        throw new UnsupportedOperationException(\"Companions are not supported in Java.\");\n    }\n\n    default ByteCodeType entityCompanionBase() {\n        throw new UnsupportedOperationException(\"Companions are not supported in Java.\");\n    }\n\n    ByteCodeType operations();\n\n    ByteCodeType queryType();\n\n    ByteCodeType repository();\n\n    ByteCodeType repositoryBase();\n\n    default ByteCodeType updateType() {\n        throw new UnsupportedOperationException(\"Update types are only supported in MongoDB contexts\");\n    };\n}\n","sourceCodeStart":7,"sourceCodeEnd":28,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/TypeBundle.java#L7-L28","documentation":"Panache's TypeBundle describes the type signatures used to generate repository operation bytecode. The default updateType() implementation throws UnsupportedOperationException because update-type generation is only implemented for the MongoDB flavor of Panache repositories. If your TypeBundle (or a custom extension built on panache-common) does not override updateType(), any code path that asks for the update type fails at augmentation time.","triggerScenarios":"Calling updateType() on a TypeBundle instance that uses the default implementation — i.e. generating or enhancing operations that need an update type outside a MongoDB context, such as a custom Panache-like repository enhancement for Hibernate/other persistence.","commonSituations":"Writing a custom Panache-backed repository generator reusing panache-common deployment classes; switching an enhancement that previously targeted MongoDB (where update types exist) to a non-MongoDB backend; upgrading panache-common and calling new APIs that consult updateType().","solutions":["Only invoke updateType() in MongoDB-based Panache enhancement contexts; in other contexts treat updateType as unsupported and skip update-method generation.","Override updateType() in your TypeBundle implementation to return a valid ByteCodeType if your backend supports update operations.","If you only need find/delete/persist operations, guard the call site with a capability check (e.g. instanceof or a hasUpdateType flag) instead of calling updateType()."],"exampleFix":"// before\nByteCodeType updateType = bundle.updateType(); // throws in non-Mongo context\n// after\nif (isMongoContext) {\n    ByteCodeType updateType = bundle.updateType();\n    // generate update operations\n} else {\n    // skip update generation\n}","handlingStrategy":"fallback","validationCode":"// only ask for updateType in MongoDB contexts\nif (!isMongoPanacheContext()) {\n    // skip update-operation generation\n} else {\n    ByteCodeType t = bundle.updateType();\n}","typeGuard":"boolean supportsUpdateType(TypeBundle b) {\n    try { b.updateType(); return true; }\n    catch (UnsupportedOperationException e) { return false; }\n}","tryCatchPattern":"try {\n    ByteCodeType t = bundle.updateType();\n} catch (UnsupportedOperationException e) {\n    // non-Mongo context: skip update generation\n}","preventionTips":["Only use TypeBundle.updateType() in MongoDB Panache enhancement code paths","Override updateType() for custom backends that support updates","Keep enhancement logic per-persistence-layer rather than shared"],"tags":["panache","mongodb","build-time","unsupported-operation"],"backgroundTag":"panache-update-type-unsupported","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}