{"record":{"id":"54fd347bacf93e72","repo":"conductor-oss/conductor","slug":"bad-unsupported-schema-validationmessages","errorCode":null,"errorMessage":"Bad/Unsupported schema? : {validationMessages}","messagePattern":"Bad/Unsupported schema\\? : (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"ai/src/main/java/org/conductoross/conductor/ai/LLMHelper.java","lineNumber":346,"sourceCode":"            // 3. externalRef if present, in future we will use it -- currently not supported\n            String schemaContent = objectMapper.writeValueAsString(schema.getData());\n            if (schemaContent == null) {\n                return null;\n            }\n\n            Set<ValidationMessage> validationMessages =\n                    jsonSchemaValidator.validate(schemaContent, data);\n\n            if (validationMessages != null && !validationMessages.isEmpty()) {\n                return String.format(\n                        \"Schema validation failed %s\",\n                        validationMessages.stream()\n                                .map(ValidationMessage::getMessage)\n                                .collect(Collectors.joining(\", \")));\n            }\n            return null;\n        } catch (JsonSchemaException jpe) {\n            throw new RuntimeException(\n                    \"Bad/Unsupported schema? : \" + jpe.getValidationMessages().toString());\n        } catch (JsonProcessingException jpe) {\n            throw new RuntimeException(\"Error parsing the json schema : \" + jpe.getMessage(), jpe);\n        }\n    }\n\n    @SneakyThrows\n    private LLMResponse chatComplete(\n            ChatModel chatModel, ChatOptions chatOptions, ChatCompletion input) {\n        ChatClient chatClient = ChatClient.create(chatModel);\n        if (StringUtils.isNotBlank(input.getInstructions())) {\n            input.getMessages()\n                    .addFirst(new ChatMessage(ChatMessage.Role.system, input.getInstructions()));\n        }\n\n        List<Message> messages =\n                new ArrayList<>(input.getMessages().stream().map(this::constructMessage).toList());\n","sourceCodeStart":328,"sourceCodeEnd":364,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/ai/src/main/java/org/conductoross/conductor/ai/LLMHelper.java#L328-L364","documentation":"Thrown by LLMHelper.validateJsonSchema() when the JSON schema itself is invalid or uses unsupported features, causing a JsonSchemaException from the networknt validator. This is distinct from a validation failure (which means data didn't match the schema) — this means the schema definition is malformed.","triggerScenarios":"The SchemaDef.getData() serializes to JSON that the networknt schema validator cannot parse — e.g. unknown keywords, malformed type definitions, unsupported draft versions, or circular references the validator cannot resolve.","commonSituations":"The outputSchema in the task definition contains invalid JSON Schema syntax. The schema uses a draft version incompatible with the validator. The schema has typos in keywords (e.g. 'typee' instead of 'type'). The schema references external definitions that are not resolvable.","solutions":["Validate your JSON schema using an online JSON Schema validator (e.g. jsonschemavalidator.net)","Check the exception's validation messages for specifics on what schema construct is unsupported","Ensure the schema targets JSON Schema Draft 4/7 which networknt supports","Simplify the schema to isolate which construct is causing the error"],"exampleFix":"// before: schema with invalid keyword\n{\"type\": \"object\", \"propertie\": {\"name\": {\"type\": \"string\"}}}\n// after\n{\"type\": \"object\", \"properties\": {\"name\": {\"type\": \"string\"}}, \"required\": [\"name\"]}","handlingStrategy":"validation","validationCode":"// Validate the schema is syntactically correct before the LLM call\nif (chatCompletion.getOutputSchema() != null && chatCompletion.getOutputSchema().getData() != null) {\n    String schemaContent = objectMapper.writeValueAsString(chatCompletion.getOutputSchema().getData());\n    try {\n        JsonSchemaFactory.getInstance(com.networknt.schema.SpecVersion.VersionFlag.V7)\n            .getSchema(schemaContent);\n    } catch (Exception e) {\n        throw new IllegalArgumentException(\"Invalid output schema: \" + e.getMessage(), e);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    LLMResponse response = llmHelper.chatComplete(task, llm, chatCompletion, location, logger);\n} catch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"Bad/Unsupported schema?\")) {\n        // The schema definition itself is invalid — fix the schema, not the prompt\n        log.error(\"Output schema is invalid: {}\", e.getMessage());\n        taskResult.setStatus(TaskResult.Status.FAILED_WITH_TERMINAL_ERROR);\n        taskResult.setReasonForIncompletion(\"Output schema definition is invalid: \" + e.getMessage());\n    } else {\n        throw e;\n    }\n}","preventionTips":["Validate JSON schemas with an external tool before deploying workflows","Use JSON Schema Draft 4 or 7 (networknt-supported drafts)","Avoid exotic schema features like complex $ref chains or unsupported keywords","Store schemas in version-controlled files and lint them in CI"],"tags":["ai","llm","json-schema","configuration"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}