Skip to content

Conversation

@salvogs
Copy link

@salvogs salvogs commented Nov 7, 2025

Bug Report: JMESPath Filter Parse Error with Escaped Single Quotes

Problem Description
The _get_jmespath_filter function in [document_store.py] causes a parsing error when processing metadata filters that contain single quotes. The function incorrectly escapes single quotes by adding backslashes, which creates invalid JMESPath syntax.

Error Message:

pathway.engine.EngineError: Parse error: Invalid character: \ (line 0, column 11)
(category=='food')

Root Cause:

In line 38 of [document_store.py], the function performs this transformation:

metadata_filter.replace("'", r"\'").replace("`", "'").replace('"', "")

When a metadata filter like category=='food' is processed, it becomes category=='food', which contains escaped single quotes that are invalid in JMESPath syntax.

Fix server crash when passing metadata to running DocumentStoreServer

pathway.engine.EngineError: Parse error: Invalid character: \ (line 0, column 11)
(category==\'food\')
@CLAassistant
Copy link

CLAassistant commented Nov 7, 2025

CLA assistant check
All committers have signed the CLA.

@szymondudycz
Copy link
Contributor

Hey @salvogs, thanks for this pull request - after looking at this issue I agree that this needs to be fixed. I think, however, that you should completely remove the whole line. More importantly, currently our tests are incorrect and would fail after your change (in python/pathway/xpack/llm/tests), so these would need to be fixed. Finally, this change would require an entry in the changelog, marking this change as breaking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants