{"record":{"id":"95e2db11c4cb42b0","repo":"conductor-oss/conductor","slug":"error-errors-response-output","errorCode":null,"errorMessage":"{\"error\":{errors},\"response\":{output}}","messagePattern":"(.+?),\"response\":(.+?)\\}","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"ai/src/main/java/org/conductoross/conductor/ai/LLMHelper.java","lineNumber":280,"sourceCode":"                        } else {\n                            error =\n                                    validateJsonSchema(\n                                            input.getInputSchema(),\n                                            (Map<String, Object>) responseObj);\n                        }\n                        if (error != null) {\n                            errors.add(\n                                    String.format(\n                                            \"Output does not confirm to the schema.  errors: %s\",\n                                            error));\n                        }\n                    }\n                    output.add(responseObj);\n                }\n                llmResponse.setResult(output);\n                if (input.isJsonOutput() && !hasJsonOutput && !llmResponse.hasToolCalls()) {\n                    Map<String, Object> outputErrors = Map.of(\"error\", errors, \"response\", output);\n                    throw new RuntimeException(objectMapper.writeValueAsString(outputErrors));\n                }\n            }\n            default -> llmResponse.setResult(result.toString());\n        }\n    }\n\n    @SneakyThrows\n    private Object tryToConvertToJSON(String responseText, ChatCompletion chatCompletion) {\n        try {\n            responseText = responseText.trim();\n            if (responseText.startsWith(\"```json\")) {\n                responseText = responseText.substring(\"```json\".length());\n                responseText =\n                        responseText.substring(0, responseText.length() - \"```\".length() - 1);\n            }\n            Map<String, Object> map = objectMapper.readValue(responseText, MAP_OF_STRING_TO_OBJ);\n            if (chatCompletion.getOutputSchema() != null) {\n                String error = validateJsonSchema(chatCompletion.getInputSchema(), map);","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/ai/src/main/java/org/conductoross/conductor/ai/LLMHelper.java#L262-L298","documentation":"Thrown in LLMHelper.extractResponse() when JSON output was requested (input.isJsonOutput()) but the LLM returned an empty response list (hasJsonOutput stays false) and there are no tool calls. The exception carries a JSON string with 'error' and 'response' keys detailing what went wrong during JSON extraction.","triggerScenarios":"The LLM returns a List result that is empty or where no iteration ran, isJsonOutput() is true on the ChatCompletion, and llmResponse.hasToolCalls() is false. This is an edge case where the model produced no usable output when structured JSON was expected.","commonSituations":"The LLM returned an empty or whitespace-only response. The model hit a content filter or max-token limit and produced no text. The prompt was malformed causing the model to return nothing. A provider API change caused empty results.","solutions":["Inspect the thrown JSON payload — the 'error' array and 'response' array reveal what the model actually returned","Check the LLM finishReason (e.g. CONTENT_FILTER, MAX_TOKENS) to understand why no text was produced","Increase maxTokens or adjust the prompt to avoid content-filter triggers","Retry the call — empty responses can be transient with some providers"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Before expecting JSON output, verify the ChatCompletion is properly configured\nif (chatCompletion.isJsonOutput()) {\n    // Ensure the prompt includes clear JSON formatting instructions\n    // and maxTokens is sufficient for the expected output size\n}","typeGuard":null,"tryCatchPattern":"try {\n    LLMResponse response = llmHelper.chatComplete(task, llm, chatCompletion, location, logger);\n} catch (RuntimeException e) {\n    // The message is a JSON string with 'error' and 'response' keys\n    try {\n        Map<String, Object> payload = objectMapper.readValue(e.getMessage(), Map.class);\n        List<String> errors = (List<String>) payload.get(\"error\");\n        List<Object> responses = (List<Object>) payload.get(\"response\");\n        log.warn(\"LLM JSON output failed: errors={}, responses={}\", errors, responses);\n    } catch (Exception parseEx) {\n        log.error(\"Unexpected error from LLM helper: {}\", e.getMessage(), e);\n    }\n    taskResult.setStatus(TaskResult.Status.FAILED);\n    taskResult.setReasonForIncompletion(e.getMessage());\n}","preventionTips":["Set isJsonOutput only when the prompt clearly instructs the model to produce JSON","Ensure maxTokens is large enough for the expected JSON output","Include an example of the expected output format in the prompt"],"tags":["ai","llm","json-output","empty-response"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}