MarkItDownConverter drops ByteStream metadata other than file_path

Open
#4,267 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@subrahmanyahegde24 is already working on this.

Since Nov 16, 2026.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
54/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend

Research direction

Open haystack_integrations/components/converters/markitdown/__init__.py and read the run method where each ByteStream's meta is turned into the output Document's meta — today only file_path is copied, then normalized by store_full_path and merged with the user-supplied meta. Start from the reproducer in the issue to see the loss, then check the converter's existing tests under test/.../markitdown to mirror their parameterized style. Done means source meta (author, language) survives, file_path is still normalized, and explicit run meta still wins; the four new regressions and the existing 17 unit tests pass.

Written by the indexing model from the issue text.

Description

integration:markitdown P2

A local text ByteStream carrying author and language metadata loses both during conversion. Explicit metadata passed to run is kept, but the source metadata is not merged into the Document.

from haystack.dataclasses import ByteStream
from haystack_integrations.components.converters.markitdown import MarkItDownConverter

source = ByteStream(
    data=b"Hello local text",
    mime_type="text/plain",
    meta={"file_path": "/original/input.txt", "author": "Alice", "language": "en"},
)
result = MarkItDownConverter().run(sources=[source])
print(result["documents"][0].meta)
# Actual: {"file_path": "input.txt"}

Expected: retain author and language, normalize file_path according to store_full_path, and let explicit run metadata override source values.

Checked on main at d88734f71069612b119c589372cbc6f767a7f76a with Python 3.12.0, MarkItDown 0.1.9 and Haystack 3.4.1. Four real local text conversions reproduce the loss. A fresh check confirms that the current main converter still copies only file_path from ByteStream metadata. A small local candidate copies source.meta before the existing path normalization and user metadata merge. It preserves the source mapping and existing override precedence.

Four parameterized regressions fail on main and pass with the candidate. The unit suite passes 17 tests, with 1 integration test deselected. Ruff and mypy pass. No external conversion service was used.

Would this be welcome as a focused fix? If so, could you assign it to @SuhrudhC? I have not opened a PR. The original converter PR #3045 was checked, including its review discussion, and the proposed change preserves its direct source handling.

This report and local candidate were prepared with Codex, which ran the checks above. No human code review is claimed.

Dominant language
Python
Stars
212
Forks
396
Avg merge
2d 9h
Merged PRs (30d)
95

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from deepset-ai/haystack-core-integrations

All issues in deepset-ai/haystack-core-integrations

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.