#8239·mitmproxy

MitmWeb disconnects when writing filter with unmatched quote

Author: fwdekker-pcCreated May 18, 2026Updated Aug 26, 2026
Labelskind/bug

Problem Description

When I write a filter that (accidentally) ends with a quote that has no corresponding opening quote, the MitmWeb tab disconnects. Removing the terminating quote from the filter does not restore the connection.

Steps to reproduce the behavior

  1. Launch mitmweb.
  2. Write or paste into the search bar: ~u Content-Type'.

Expected result

MitmWeb ignores the invalid filter. Maybe a warning is written to stdout, or shown in the interface.

Actual result

Immediately upon writing the final ', the MitmWeb interface starts indicating "connection lost", and the following message is written to stdout:

[11:21:52.455] Error processing message from <mitmproxy.tools.web.app.ClientConnection object at 0x000001A083FC67B0>: Invalid filter expression: "~u Content-Type'"

Workaround

Change the URL from http://127.0.0.1:8081/#/flows?s=~u%20Content-Type' to http://127.0.0.1:8081/#/flows?s=~u%20Content-Type, press Enter to confirm the change, and then press F5 to refresh the page. The connection is re-established and MitmWeb can be used normally again.

System Information

Mitmproxy: 12.2.3
Python:    3.14.5
OpenSSL:   OpenSSL 3.5.4 30 Sep 2025
Platform:  Windows-11-10.0.26200-SP0

Checklist