{"record":{"id":"18cbae2ddaf11356","repo":"appsmithorg/appsmith","slug":"pe-fst-5000","errorCode":"PE-FST-5000","errorMessage":"Unable to serialize object of type %s.","messagePattern":"Unable to serialize object of type (.+?)\\.","errorType":"exception","errorClass":"AppsmithPluginException","httpStatus":500,"severity":"error","filePath":"app/server/appsmith-plugins/firestorePlugin/src/main/java/com/external/plugins/FirestorePlugin.java","lineNumber":887,"sourceCode":"                        \"path\", documentReference.getPath());\n\n            } else if (objResult instanceof Map) {\n                Map<String, Object> resultMap = (Map) objResult;\n                for (final Map.Entry<String, Object> entry : resultMap.entrySet()) {\n                    resultMap.put(entry.getKey(), resultToMap(entry.getValue(), false));\n                }\n                return resultMap;\n\n            } else if (objResult instanceof List) {\n                List<Object> original = (List) objResult;\n                List<Object> converted = new ArrayList<>();\n                for (final Object item : original) {\n                    converted.add(resultToMap(item, false));\n                }\n                return converted;\n\n            } else if (isRoot) {\n                throw new AppsmithPluginException(\n                        FirestorePluginError.QUERY_EXECUTION_FAILED,\n                        String.format(\n                                FirestoreErrorMessages.OBJECT_SERIALIZATION_FAILED_ERROR_MSG,\n                                objResult.getClass().getName()));\n            }\n\n            return objResult;\n        }\n\n        @Override\n        public Mono<Firestore> datasourceCreate(DatasourceConfiguration datasourceConfiguration) {\n            log.debug(Thread.currentThread().getName() + \": datasourceCreate() called for Firestore plugin.\");\n            final DBAuth authentication = (DBAuth) datasourceConfiguration.getAuthentication();\n\n            final Set<String> errors = validateDatasource(datasourceConfiguration);\n            if (!CollectionUtils.isEmpty(errors)) {\n                return Mono.error(new AppsmithPluginException(\n                        AppsmithPluginError.PLUGIN_DATASOURCE_ARGUMENT_ERROR,","sourceCodeStart":869,"sourceCodeEnd":905,"githubUrl":"https://github.com/appsmithorg/appsmith/blob/8cd9021c24cdbea1c3c12c966073708e83db60c2/app/server/appsmith-plugins/firestorePlugin/src/main/java/com/external/plugins/FirestorePlugin.java#L869-L905","documentation":"The Firestore plugin's resultToMap serialization helper (FirestorePlugin.java:886-892) throws this when the top-level Firestore query result (isRoot=true) is not one of the recognized types: QuerySnapshot, DocumentReference, Map, or List. The error message includes the actual Java class name via String.format with objResult.getClass().getName(). This is filed under FirestorePluginError.QUERY_EXECUTION_FAILED (PE-FST-5000), indicating a structural mismatch between the Firestore driver's return type and the plugin's serialization logic.","triggerScenarios":"A Firestore operation returns a top-level result object whose Java type is not Map, List, QuerySnapshot, or DocumentReference. This can happen when the Firestore SDK is upgraded and introduces a new return type, when a custom or edge-case query (e.g., aggregate count, batch write) returns a specialized result object, or when the plugin's type-detection chain (lines 860-884) fails to match.","commonSituations":"1) Firestore SDK version change introducing new result types not handled by the plugin's if-else chain. 2) Running an aggregation or batch operation whose result wrapper class is not a Map/List/snapshot. 3) Plugin code out of sync with the installed Firestore driver version. 4) A query returning a raw primitive or SDK-internal object at the root level.","solutions":["Check the error message for the %s class name — it tells you exactly which type the serializer could not handle.","Update the Appsmith Firestore plugin to the latest version, which may add handling for newer SDK return types.","Simplify the query to return a standard document or collection result rather than a specialized aggregate type.","If this is reproducible, report the class name to Appsmith support so the resultToMap if-else chain can be extended.","As a workaround, restructure the query to return a Map or List-shaped result."],"exampleFix":"// The error surfaces the unhandled type, e.g.:\n// \"Unable to serialize object of type com.google.cloud.firestore.AggregateQuerySnapshot.\"\n\n// Workaround: use a standard collection query instead of an aggregate:\n// before (unhandled aggregate result):\n//   query.count().get()\n// after (standard collection GET):\n//   db.collection(\"myCollection\").get()","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Wrap Firestore plugin calls and catch AppsmithPluginException by error code\ntry {\n  const result = await firestoreQuery.run();\n} catch (err) {\n  if (err.code === 'PE-FST-5000' && err.message.includes('Unable to serialize')) {\n    // The Firestore result type is not handled by the plugin serializer\n    console.error('Unhandled Firestore result type:', err.message);\n    // Workaround: use a simpler query that returns standard document/collection results\n  } else {\n    throw err;\n  }\n}","preventionTips":["Keep the Firestore plugin updated to handle newer SDK return types.","Avoid aggregate or specialized query types that may return non-standard result objects.","Report the unhandled class name (shown in the error message) to Appsmith support."],"tags":["firestore","serialization","sdk-compatibility","appsmith"],"backgroundTag":null,"analyzedSha":"8cd9021c24cdbea1c3c12c966073708e83db60c2","analyzedAt":"2026-08-12T22:14:19.293Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}