{"record":{"id":"df5a3a7ee66c69f9","repo":"appsmithorg/appsmith","slug":"pe-gsh-5000-df5a3a","errorCode":"PE-GSH-5000","errorMessage":"Missing a valid response object.","messagePattern":"Missing a valid response object\\.","errorType":"exception","errorClass":"AppsmithPluginException","httpStatus":500,"severity":"error","filePath":"app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/FileListMethod.java","lineNumber":58,"sourceCode":"    @Override\n    public WebClient.RequestHeadersSpec<?> getExecutionClient(WebClient webClient, MethodConfig methodConfig) {\n        UriComponentsBuilder uriBuilder = getBaseUriBuilder(\n                this.BASE_DRIVE_API_URL,\n                \"?orderBy=name&q=mimeType%3D'application%2Fvnd.google-apps.spreadsheet'%20and%20trashed%3Dfalse\"\n                        + SHARED_DRIVE_PARAMS,\n                true);\n\n        return webClient\n                .method(HttpMethod.GET)\n                .uri(uriBuilder.build(true).toUri())\n                .body(BodyInserters.empty());\n    }\n\n    @Override\n    public JsonNode transformExecutionResponse(\n            JsonNode response, MethodConfig methodConfig, Set<String> userAuthorizedSheetIds) {\n        if (response == null) {\n            throw new AppsmithPluginException(\n                    GSheetsPluginError.QUERY_EXECUTION_FAILED, ErrorMessages.MISSING_VALID_RESPONSE_ERROR_MSG);\n        }\n        if (response.get(\"files\") == null) {\n            return this.objectMapper.createArrayNode();\n        }\n        List<Map<String, String>> filesList = StreamSupport.stream(\n                        response.get(\"files\").spliterator(), false)\n                .map(file -> getSpreadsheetData((JsonNode) file, userAuthorizedSheetIds, GoogleSheetMethodEnum.EXECUTE))\n                .filter(Objects::nonNull)\n                .collect(Collectors.toList());\n\n        return this.objectMapper.valueToTree(filesList);\n    }\n\n    @Override\n    public boolean validateTriggerMethodRequest(MethodConfig methodConfig) {\n        return this.validateExecutionMethodRequest(methodConfig);\n    }","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/appsmithorg/appsmith/blob/8cd9021c24cdbea1c3c12c966073708e83db60c2/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/FileListMethod.java#L40-L76","documentation":"Thrown by FileListMethod.transformExecutionResponse (FileListMethod.java:58) with code PE-GSH-5000. The 'List Spreadsheets' (execute) action expects a non-null JSON response from the Drive API `files` list call to iterate `response.get(\"files\")`. A null response aborts before the files-array check.","triggerScenarios":"The Drive files-list GET returned a body that arrived null at the transform — empty response, a nulled non-JSON error, or a Webclient filter that consumed the body. The null guard is the first statement, so it fires immediately.","commonSituations":"OAuth token expired (401 body nulled); the authorized account has zero spreadsheets and the API returned an unexpected empty body; rate limiting (429) error body lost; response adapter misconfiguration stripping bodies.","solutions":["Re-authorize the Google Sheets datasource if the OAuth token expired.","Enable plugin HTTP logging to inspect the actual status and body.","Confirm the authorized Google account owns or is shared on at least one spreadsheet.","If patching the plugin, coerce a null body to an empty object node before invoking transformExecutionResponse."],"exampleFix":"// before — list body arrives null\npublic JsonNode transformExecutionResponse(JsonNode response, ...) {\n    if (response == null) { throw ...; }\n    if (response.get(\"files\") == null) { return objectMapper.createArrayNode(); }\n    ...\n}\n// after — caller coerces empty\nJsonNode node = body == null ? objectMapper.createObjectNode() : objectMapper.readTree(body);\nreturn method.transformExecutionResponse(node, config, ids);","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"async function listSpreadsheetsSafe() {\n  try { return await listSpreadsheets.run(); }\n  catch (e) {\n    if (e && /Missing a valid response object/.test(e.message)) {\n      await refreshToken();\n      return await listSpreadsheets.run();\n    }\n    throw e;\n  }\n}","preventionTips":["Keep OAuth credentials valid; expired tokens often produce null bodies.","Confirm the authorized account owns or is shared on at least one spreadsheet.","Enable HTTP logging to see the real Drive files-list response."],"tags":["google-sheets","appsmith","response-handling","list-spreadsheets","null-response"],"backgroundTag":null,"analyzedSha":"8cd9021c24cdbea1c3c12c966073708e83db60c2","analyzedAt":"2026-08-12T22:14:19.293Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}