conductor-oss/conductor · error · RuntimeException

Bad/Unsupported schema? : {validationMessages}

Error message

Bad/Unsupported schema? : {validationMessages}

What it means

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.

Source

Thrown at ai/src/main/java/org/conductoross/conductor/ai/LLMHelper.java:346

            // 3. externalRef if present, in future we will use it -- currently not supported
            String schemaContent = objectMapper.writeValueAsString(schema.getData());
            if (schemaContent == null) {
                return null;
            }

            Set<ValidationMessage> validationMessages =
                    jsonSchemaValidator.validate(schemaContent, data);

            if (validationMessages != null && !validationMessages.isEmpty()) {
                return String.format(
                        "Schema validation failed %s",
                        validationMessages.stream()
                                .map(ValidationMessage::getMessage)
                                .collect(Collectors.joining(", ")));
            }
            return null;
        } catch (JsonSchemaException jpe) {
            throw new RuntimeException(
                    "Bad/Unsupported schema? : " + jpe.getValidationMessages().toString());
        } catch (JsonProcessingException jpe) {
            throw new RuntimeException("Error parsing the json schema : " + jpe.getMessage(), jpe);
        }
    }

    @SneakyThrows
    private LLMResponse chatComplete(
            ChatModel chatModel, ChatOptions chatOptions, ChatCompletion input) {
        ChatClient chatClient = ChatClient.create(chatModel);
        if (StringUtils.isNotBlank(input.getInstructions())) {
            input.getMessages()
                    .addFirst(new ChatMessage(ChatMessage.Role.system, input.getInstructions()));
        }

        List<Message> messages =
                new ArrayList<>(input.getMessages().stream().map(this::constructMessage).toList());

View on GitHub (pinned to cf7c3e4a8a)

Solutions

  1. Validate your JSON schema using an online JSON Schema validator (e.g. jsonschemavalidator.net)
  2. Check the exception's validation messages for specifics on what schema construct is unsupported
  3. Ensure the schema targets JSON Schema Draft 4/7 which networknt supports
  4. Simplify the schema to isolate which construct is causing the error

Example fix

// before: schema with invalid keyword
{"type": "object", "propertie": {"name": {"type": "string"}}}
// after
{"type": "object", "properties": {"name": {"type": "string"}}, "required": ["name"]}
Defensive patterns

Strategy: validation

Validate before calling

// Validate the schema is syntactically correct before the LLM call
if (chatCompletion.getOutputSchema() != null && chatCompletion.getOutputSchema().getData() != null) {
    String schemaContent = objectMapper.writeValueAsString(chatCompletion.getOutputSchema().getData());
    try {
        JsonSchemaFactory.getInstance(com.networknt.schema.SpecVersion.VersionFlag.V7)
            .getSchema(schemaContent);
    } catch (Exception e) {
        throw new IllegalArgumentException("Invalid output schema: " + e.getMessage(), e);
    }
}

Try / catch

try {
    LLMResponse response = llmHelper.chatComplete(task, llm, chatCompletion, location, logger);
} catch (RuntimeException e) {
    if (e.getMessage().startsWith("Bad/Unsupported schema?")) {
        // The schema definition itself is invalid — fix the schema, not the prompt
        log.error("Output schema is invalid: {}", e.getMessage());
        taskResult.setStatus(TaskResult.Status.FAILED_WITH_TERMINAL_ERROR);
        taskResult.setReasonForIncompletion("Output schema definition is invalid: " + e.getMessage());
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of conductor-oss/conductor@cf7c3e4a8a (2026-08-14). Data as JSON: /api/errors/54fd347bacf93e72. Report an issue: GitHub.