{"record":{"id":"699bdf449b78f6dc","repo":"conductor-oss/conductor","slug":"markdown-content-must-not-be-null","errorCode":null,"errorMessage":"markdown content must not be null","messagePattern":"markdown content must not be null","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"ai/src/main/java/org/conductoross/conductor/ai/pdf/MarkdownToPdfConverter.java","lineNumber":62,"sourceCode":"@Conditional(AIIntegrationEnabledCondition.class)\n@Slf4j\npublic class MarkdownToPdfConverter {\n\n    private final PdfImageResolver imageResolver;\n\n    public MarkdownToPdfConverter(PdfImageResolver imageResolver) {\n        this.imageResolver = imageResolver;\n    }\n\n    /**\n     * Converts markdown text to a PDF byte array.\n     *\n     * @param request the conversion request containing markdown and layout options\n     * @return the generated PDF as a byte array\n     */\n    public byte[] convert(MarkdownToPdfRequest request) {\n        if (request.getMarkdown() == null) {\n            throw new IllegalArgumentException(\"markdown content must not be null\");\n        }\n\n        // Step 1: Parse markdown to AST\n        Document markdownAst = parseMarkdown(request.getMarkdown());\n\n        // Step 2: Create PDF document\n        try (PDDocument document = new PDDocument()) {\n            // Step 3: Configure page size\n            PDRectangle pageSize = resolvePageSize(request.getPageSize());\n\n            // Step 4: Set PDF metadata\n            setMetadata(document, request.getPdfMetadata());\n\n            // Step 5: Create render context\n            boolean compact = \"compact\".equalsIgnoreCase(request.getTheme());\n            PdfRenderContext ctx =\n                    new PdfRenderContext(\n                            document,","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/ai/src/main/java/org/conductoross/conductor/ai/pdf/MarkdownToPdfConverter.java#L44-L80","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the caller always sets markdown on the request before calling convert().","Validate at the boundary: if markdown is null, either default to empty string or reject with a clearer domain error upstream.","Trace where the request is constructed and confirm the markdown source is non-null."],"exampleFix":"// before\nMarkdownToPdfRequest req = new MarkdownToPdfRequest();\n// req.setMarkdown omitted -> null\nbyte[] pdf = converter.convert(req);\n// after\nMarkdownToPdfRequest req = new MarkdownToPdfRequest();\nString md = sourceMarkdown;\nreq.setMarkdown(md == null ? \"\" : md);\nbyte[] pdf = converter.convert(req);","handlingStrategy":"validation","validationCode":"// Validate before calling convert.\nif (request == null || request.getMarkdown() == null) {\n    throw new IllegalArgumentException(\"MarkdownToPdfRequest.markdown must be set\");\n}\nconverter.convert(request);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set markdown on the request builder; treat null as a contract violation upstream.","Map workflow inputs to markdown with a null-check/default at the boundary.","Prefer empty string over null when no content is intended."],"tags":["pdf","markdown","null-input","validation","input-validation"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}