Skip to content

MitmWeb disconnects when writing filter with unmatched quote #8239

@fwdekker-pc

Description

@fwdekker-pc

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions