{"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/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_internal/vcs/subversion.py#L133-L169","documentation":"Raised inside pip's Subversion backend while parsing the legacy on-disk `.svn/entries` file to recover the repository URL and revision. When the file begins with `<?xml` (older SVN formats) but the `_svn_xml_url_re` regex fails to locate a `<url>` element, pip treats the entries data as corrupt/unparseable and raises this ValueError. It indicates the working copy's SVN metadata is in a format pip does not understand (e.g. produced by an incompatible/old SVN client or truncated).","triggerScenarios":"Calling `pip` operations that inspect an SVN checkout (install/freeze/-e) where `cls.dirname/entries` exists, starts with `<?xml`, and the URL regex returns no match. Specifically in `Subversion._get_svn_url_rev` at the `_svn_xml_url_re.search(data)` branch returning None.","commonSituations":"A working copy created by a very old SVN client (pre-1.4 WC format), a manually edited or partially-written `.svn/entries` file, a checkout corrupted by a crash/kill during `svn checkout`, or filesystem corruption. Also seen after SVN upgraded the WC format in place and left stale metadata.","solutions":["Re-checkout the SVN working copy with a current `svn` client so `.svn/entries` is regenerated, then re-run pip.","Upgrade your Subversion client to a version whose WC metadata pip can parse (SVN >= 1.7 uses the `svn info --xml` fallback path that does not hit this error).","If you only need pip to read the URL, run `svn info <path>` to confirm the repo is readable; if that fails, repair/checkout fresh.","Avoid pointing pip directly at a foreign SVN working copy; pass an `svn+http(s)://` URL instead of a local WC path."],"exampleFix":"# before\npip install -e ./my_svn_checkout   # stale .svn/entries triggers the error\n\n# after\nrm -rf my_svn_checkout && svn checkout https://myrepo/svn/MyApp/trunk my_svn_checkout\npip install -e my_svn_checkout","handlingStrategy":"validation","validationCode":"# Before pointing pip at an SVN working copy, sanity-check the entries file:\nimport os, re\nentries = os.path.join(wc_path, \".svn\", \"entries\")\nif os.path.exists(entries):\n    data = open(entries).read()\n    if data.startswith(\"<?xml\") and not re.search(r\"<url>([^<]+)</url>\", data):\n        raise RuntimeError(\"SVN entries file is unparseable; re-checkout required\")","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Always create SVN working copies with a current `svn` client (>= 1.7) so pip uses the `svn info --xml` path.","Prefer passing an `svn+https://` URL to pip over pointing at a local working copy.","Re-checkout fresh if a working copy was produced by a very old SVN or may have been corrupted."],"tags":["svn","vcs","metadata-parsing","working-copy"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}