#1103·marker

[BUG: Breaking]ollama, 400 error: Bad Request ,and error: LLM did not return a valid response

Author: Raja-Vignesh7Created Sep 10, 2026Updated Sep 10, 2026
Labelsbug: breaking

Describe the Bug

while running marker with llm service enabled, at "LLMSectionHeaderProcessor" processing part it was giving 400 error, bad request for url: http://localhost:11434/api/generate, every time. Model used for llm service gemma3:4b

Output Trace / Stack Trace

logs

log
2026-09-10 12:31:37,952 | WARNING  | marker | Ollama inference failed: 400 Client Error: Bad Request for url: http://localhost:11434/api/generate
2026-09-10 12:31:37,952 | WARNING  | marker | LLM did not return a valid response

⚙️ Environment

Please fill in all relevant details:

  • Marker version: marker-pdf==2.0.0
  • Surya version: surya-ocr==0.22.1
  • Python version: python==3.11.9
  • PyTorch version: torch==2.14.0
  • Transformers version: transformers==5.16.1
  • Operating System (incl. container info if relevant): linux (Kernel: 7.1.5-76070105-generic)

Command or Code Used

code :

python
processes = [
        'marker.processors.block_relabel.BlockRelabelProcessor',
 'marker.processors.line_merge.LineMergeProcessor',
 'marker.processors.blockquote.BlockquoteProcessor',
 'marker.processors.document_toc.DocumentTOCProcessor',
 'marker.processors.footnote.FootnoteProcessor',
 'marker.processors.ignoretext.IgnoreTextProcessor',
 'marker.processors.line_numbers.LineNumbersProcessor',
 'marker.processors.list.ListProcessor',
 'marker.processors.page_header.PageHeaderProcessor',
 'marker.processors.marginalia.MarginaliaProcessor',
 'marker.processors.sectionheader.SectionHeaderProcessor',
 'marker.processors.table.TableProcessor',
 'marker.processors.llm.llm_table.LLMTableProcessor',
 'marker.processors.llm.llm_table_merge.LLMTableMergeProcessor',
 'marker.processors.llm.llm_form.LLMFormProcessor',
 'marker.processors.text.TextProcessor',
 'marker.processors.llm.llm_complex.LLMComplexRegionProcessor',
 'marker.processors.llm.llm_image_description.LLMImageDescriptionProcessor',
 'marker.processors.llm.llm_handwriting.LLMHandwritingProcessor',
 'marker.processors.llm.llm_sectionheader.LLMSectionHeaderProcessor',
 'marker.processors.llm.llm_page_correction.LLMPageCorrectionProcessor',
 'marker.processors.reference.ReferenceProcessor',
 'marker.processors.blank_page.BlankPageProcessor',
 'marker.processors.debug.DebugProcessor'
    ]
config_dict = {
        "output_format":"json",
        "use_llm": True,
        "mode":"balanced",
        "llm_service":"marker.services.ollama.OllamaService",
        "ollama_model": 'gemma3:4b',   # Specify the LLM model want to use for correction
        "ollama_base_url": 'http://localhost:11434',
    }

config_parser = ConfigParser(config_dict)
artifact_dict = create_model_dict()

converter = PdfConverter(
                config=self._config_parser.generate_config_dict(),
                artifact_dict=self._artifact_dict,
                # processor_list=self._config_parser.get_processors(),
                processor_list=proccesses,
                renderer=self._config_parser.get_renderer(),
                lm_service=self._config_parser.get_llm_service(),
            )
rendered = converter("sample.pdf")
result_json = rendered.model_dump()

terminal output

bash
LLM processors running: 0it [00:00, ?it/s]
Running LLMSectionHeaderProcessor:   0%|                                                                                                                | 0/1 [00:00<?, ?it/s]2026-09-10 22:40:00,189 [WARNING] marker: Ollama inference failed: 400 Client Error: Bad Request for url: http://localhost:11434/api/generate
2026-09-10 22:40:00,190 [WARNING] marker: LLM did not return a valid response
Running LLMSectionHeaderProcessor: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:22<00:00, 22.34s/it]

Additional Context

relavent issues: #794 #984 #907