{"record":{"id":"41da83f5b79d8251","repo":"mitmproxy/mitmproxy","slug":"invalid-configuration-file-conf-path-e","errorCode":null,"errorMessage":"Invalid configuration file ({conf_path}): {e}","messagePattern":"Invalid configuration file \\((.+?)\\): (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mitmproxy/proxy/mode_servers.py","lineNumber":369,"sourceCode":"\n        if not conf_path.exists():\n            conf_path.parent.mkdir(parents=True, exist_ok=True)\n            conf_path.write_text(\n                json.dumps(\n                    {\n                        \"server_key\": mitmproxy_rs.wireguard.genkey(),\n                        \"client_key\": mitmproxy_rs.wireguard.genkey(),\n                    },\n                    indent=4,\n                )\n            )\n\n        try:\n            c = json.loads(conf_path.read_text())\n            self.server_key = c[\"server_key\"]\n            self.client_key = c[\"client_key\"]\n        except Exception as e:\n            raise ValueError(f\"Invalid configuration file ({conf_path}): {e}\") from e\n\n        # error early on invalid keys\n        self.pubkey = mitmproxy_rs.wireguard.pubkey(self.client_key)\n        _ = mitmproxy_rs.wireguard.pubkey(self.server_key)\n\n        await super()._start()\n\n        conf = self.client_conf()\n        assert conf\n        logger.info(\"-\" * 60 + \"\\n\" + conf + \"\\n\" + \"-\" * 60)\n\n    async def start_udp_based_server(\n        self, host, port\n    ) -> mitmproxy_rs.wireguard.WireGuardServer:\n        return await mitmproxy_rs.wireguard.start_wireguard_server(\n            host,\n            port,\n            self.server_key,","sourceCodeStart":351,"sourceCodeEnd":387,"githubUrl":"https://github.com/mitmproxy/mitmproxy/blob/2ac5b089d953585c66026a53f678270e094e48e5/mitmproxy/proxy/mode_servers.py#L351-L387","documentation":"Error \"Invalid configuration file ({conf_path}): {e}\" thrown in mitmproxy/mitmproxy.","triggerScenarios":"Thrown at mitmproxy/proxy/mode_servers.py:369 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2ac5b089d953585c66026a53f678270e094e48e5","analyzedAt":"2026-08-26T07:49:02.629Z","schemaVersion":2},"datasetVersion":"2026-08-26T14:46:13.012Z"}