{"record":{"id":"582f2b8d02656538","repo":"pypa/pip","slug":"badly-formatted-data-data-r","errorCode":null,"errorMessage":"Badly formatted data: {data!r}","messagePattern":"Badly formatted data: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/vcs/subversion.py","lineNumber":151,"sourceCode":"        from pip._internal.exceptions import InstallationError\n\n        entries_path = os.path.join(location, cls.dirname, \"entries\")\n        if os.path.exists(entries_path):\n            with open(entries_path) as f:\n                data = f.read()\n        else:  # subversion >= 1.7 does not have the 'entries' file\n            data = \"\"\n\n        url = None\n        if data.startswith((\"8\", \"9\", \"10\")):\n            entries = list(map(str.splitlines, data.split(\"\\n\\x0c\\n\")))\n            del entries[0][0]  # get rid of the '8'\n            url = entries[0][3]\n            revs = [int(d[9]) for d in entries if len(d) > 9 and d[9]] + [0]\n        elif data.startswith(\"<?xml\"):\n            match = _svn_xml_url_re.search(data)\n            if not match:\n                raise ValueError(f\"Badly formatted data: {data!r}\")\n            url = match.group(1)  # get repository URL\n            revs = [int(m.group(1)) for m in _svn_rev_re.finditer(data)] + [0]\n        else:\n            try:\n                # subversion >= 1.7\n                # Note that using get_remote_call_options is not necessary here\n                # because `svn info` is being run against a local directory.\n                # We don't need to worry about making sure interactive mode\n                # is being used to prompt for passwords, because passwords\n                # are only potentially needed for remote server requests.\n                xml = cls.run_command(\n                    [\"info\", \"--xml\", location],\n                    show_stdout=False,\n                    stdout_only=True,\n                )\n                match = _svn_info_xml_url_re.search(xml)\n                assert match is not None\n                url = match.group(1)","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/pypa/pip/blob/f399c3718970b1b0e2478dac5296eb62679a9b86/src/pip/_internal/vcs/subversion.py#L133-L169","documentation":"Raised by Subversion._get_svn_url_rev() when parsing the legacy SVN 'entries' file in XML format and the repository URL regex (_svn_xml_url_re) finds no match. This indicates the SVN metadata file exists and starts with '<?xml' but does not contain a recognizable url attribute.","triggerScenarios":"Calling _get_svn_url_rev(location) where the .svn/entries file starts with '<?xml' but _svn_xml_url_re.search(data) returns None (no url=\"...\" attribute found). Reached during SVN-based VCS installation or when pip inspects an SVN working copy.","commonSituations":"A very old or unusual SVN client version that wrote the entries file in a different XML schema. A corrupted .svn/entries file. An SVN working copy checked out by a third-party tool. This is increasingly rare as modern SVN (>= 1.7) uses a different metadata format that falls through to 'svn info'.","solutions":["Upgrade the SVN client: 'svn --version' — modern SVN uses a format that bypasses this code path","Re-checkout the working copy with a current SVN client: 'svn checkout <url>'","Run 'svn info <location>' manually to verify the working copy is valid","Avoid SVN-based pip installs if possible; migrate to git or use a direct download"],"exampleFix":"// before\npip install svn+http://example.com/svn/MyApp#egg=MyApp\n# old SVN working copy with malformed entries\n// after\nsvn --version  # upgrade if < 1.7\nsvn checkout http://example.com/svn/MyApp fresh_checkout\npip install ./fresh_checkout","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"import re\n\n_XML_URL_RE = re.compile('url=\"([^\"]+)\"')\n\ndef svn_xml_has_url(data: str) -> bool:\n    return bool(_XML_URL_RE.search(data)) if data.startswith('<?xml') else True","tryCatchPattern":"try:\n    url, rev = Subversion._get_svn_url_rev(location)\nexcept ValueError as e:\n    if 'Badly formatted data' in str(e):\n        # re-checkout with a modern SVN client\n        raise EnvironmentError(f'SVN metadata corrupt or unsupported version: {e}')\n    raise","preventionTips":["Use a modern SVN client (>= 1.7) that bypasses the legacy entries file","Re-checkout working copies with a current SVN version","Verify with 'svn info <location>' before pip install","Migrate from SVN to git where possible"],"tags":["svn","vcs","parsing","metadata","legacy"],"backgroundTag":null,"analyzedSha":"f399c3718970b1b0e2478dac5296eb62679a9b86","analyzedAt":"2026-08-08T23:01:42.227Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}