conductor-oss/conductor · error · IllegalArgumentException

markdown content must not be null

Error message

markdown content must not be null

What it means

Thrown by MarkdownToPdfConverter.convert when request.getMarkdown() is null. The converter requires non-null markdown text as input; a null markdown (as opposed to empty) is treated as a programmer/contract error and rejected before any parsing. Note empty string is allowed through (parseMarkdown handles it).

Source

Thrown at ai/src/main/java/org/conductoross/conductor/ai/pdf/MarkdownToPdfConverter.java:62

@Conditional(AIIntegrationEnabledCondition.class)
@Slf4j
public class MarkdownToPdfConverter {

    private final PdfImageResolver imageResolver;

    public MarkdownToPdfConverter(PdfImageResolver imageResolver) {
        this.imageResolver = imageResolver;
    }

    /**
     * Converts markdown text to a PDF byte array.
     *
     * @param request the conversion request containing markdown and layout options
     * @return the generated PDF as a byte array
     */
    public byte[] convert(MarkdownToPdfRequest request) {
        if (request.getMarkdown() == null) {
            throw new IllegalArgumentException("markdown content must not be null");
        }

        // Step 1: Parse markdown to AST
        Document markdownAst = parseMarkdown(request.getMarkdown());

        // Step 2: Create PDF document
        try (PDDocument document = new PDDocument()) {
            // Step 3: Configure page size
            PDRectangle pageSize = resolvePageSize(request.getPageSize());

            // Step 4: Set PDF metadata
            setMetadata(document, request.getPdfMetadata());

            // Step 5: Create render context
            boolean compact = "compact".equalsIgnoreCase(request.getTheme());
            PdfRenderContext ctx =
                    new PdfRenderContext(
                            document,

View on GitHub (pinned to cf7c3e4a8a)

Solutions

  1. Ensure the caller always sets markdown on the request before calling convert().
  2. Validate at the boundary: if markdown is null, either default to empty string or reject with a clearer domain error upstream.
  3. Trace where the request is constructed and confirm the markdown source is non-null.

Example fix

// before
MarkdownToPdfRequest req = new MarkdownToPdfRequest();
// req.setMarkdown omitted -> null
byte[] pdf = converter.convert(req);
// after
MarkdownToPdfRequest req = new MarkdownToPdfRequest();
String md = sourceMarkdown;
req.setMarkdown(md == null ? "" : md);
byte[] pdf = converter.convert(req);
Defensive patterns

Strategy: validation

Validate before calling

// Validate before calling convert.
if (request == null || request.getMarkdown() == null) {
    throw new IllegalArgumentException("MarkdownToPdfRequest.markdown must be set");
}
converter.convert(request);

Prevention

When it happens

Trigger: Calling convert() with a MarkdownToPdfRequest whose markdown field was never set (null), e.g. when building the request from a workflow variable that was absent, a JSON deserialize that omitted the field, or a code path that forgot to populate it.

Common situations: Workflow task input mapped to markdown is missing/empty; request object built with a builder that left markdown unset; upstream producer sent a payload without the markdown field.

Related errors


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