When trying to get a copy of a branch of a private bzr repository using a command like `bzr branch lp:<private bzr repository name>`, it errors out with an exception that looks like.
<snip>
❯ bzr branch lp:<private bzr repository>
Ignoring insteadOf lp: in git config, because the Launchpad plugin is loaded.
brz: ERROR: lazr.restfulclient.errors.ServerError: HTTP Error 500: Internal Server Error
Response headers:
---
-content-encoding: gzip
connection: close
content-length: 2336
content-type: text/plain;charset=utf-8
date: Fri, 06 Oct 2023 08:20:32 GMT
server: gunicorn
status: 500
vary: Accept-Encoding
x-lazr-oopsid: OOPS-ed564e31c31cb77087ac3e21adc82c40
x-powered-by: Zope (www.zope.org), Python (www.python.org)
x-request-id: 06077fe8-3016-427d-8ffb-1ce704a883b9
x-vcs-revision: bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596
---
Response body:
---
b'Private branch ~<user>/<private bzr repository>/trunk has no public URL.\n\nTraceback (most recent call last):\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/zope/publisher/publish.py", line 146, in publish\n result = publication.callObject(request, obj)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/publisher.py", line 221, in callObject\n value = super().callObject(request, object)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/lib/lp/services/webapp/publication.py", line 446, in callObject\n return mapply(ob, request.getPositionalArguments(), request)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/zope/publisher/publish.py", line 119, in mapply\n return debug_call(obj, args)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/zope/publisher/publish.py", line 126, in debug_call\n return obj(*args)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/_resource.py", line 954, in __call__\n result = self.do_GET()\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/_resource.py", line 1621, in do_GET\n result = self.handleCustomGET(operation_name)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/_resource.py", line 749, in handleCustomGET\n return operation()\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/_operation.py", line 94, in __call__\n response = self.call(**values)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/declarations.py", line 1655, in call\n result = self._getMethod()(**params)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/lib/lp/code/model/branch.py", line 854, in composePublicURL\n assert not (self.private and scheme in public_schemes), (\nAssertionError: Private branch ~<user>/<private bzr repository>/trunk has no public URL.\n'
---
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/breezy/commands.py", line 1032, in exception_to_return_code
return the_callable(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/breezy/commands.py", line 1224, in run_bzr
ret = run(*run_argv)
^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/breezy/commands.py", line 774, in run_argv_aliases
return self.run(**all_cmd_args)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/breezy/commands.py", line 799, in run
return class_run(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/breezy/builtins.py", line 1456, in run
accelerator_tree, br_from = controldir.ControlDir.open_tree_or_branch(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/breezy/controldir.py", line 885, in open_tree_or_branch
controldir = klass.open(location)
^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/breezy/controldir.py", line 789, in open
t = _mod_transport.get_transport(base, possible_transports)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/breezy/transport/__init__.py", line 1594, in get_transport
location_to_url(base, purpose=purpose),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/breezy/location.py", line 141, in location_to_url
location = directories.dereference(location, purpose)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/breezy/directory_service.py", line 87, in dereference
return directory.look_up(name, url, purpose=purpose)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/breezy/plugins/launchpad/lp_directory.py", line 137, in look_up
return _resolve(url)
^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/breezy/plugins/launchpad/lp_directory.py", line 106, in _resolve
result = _resolve_via_api(path, url)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/breezy/plugins/launchpad/lp_directory.py", line 91, in _resolve_via_api
join(lp_branch.composePublicURL(scheme='http'), *subpaths)]}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py", line 642, in __call__
response, content = self.root._browser._request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 484, in _request
raise error
lazr.restfulclient.errors.ServerError: HTTP Error 500: Internal Server Error
Response headers:
---
-content-encoding: gzip
connection: close
content-length: 2336
content-type: text/plain;charset=utf-8
date: Fri, 06 Oct 2023 08:20:32 GMT
server: gunicorn
status: 500
vary: Accept-Encoding
x-lazr-oopsid: OOPS-ed564e31c31cb77087ac3e21adc82c40
x-powered-by: Zope (www.zope.org), Python (www.python.org)
x-request-id: 06077fe8-3016-427d-8ffb-1ce704a883b9
x-vcs-revision: bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596
---
Response body:
---
b'Private branch ~<user>/<private bzr repository>/trunk has no public URL.\n\nTraceback (most recent call last):\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/zope/publisher/publish.py", line 146, in publish\n result = publication.callObject(request, obj)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/publisher.py", line 221, in callObject\n value = super().callObject(request, object)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/lib/lp/services/webapp/publication.py", line 446, in callObject\n return mapply(ob, request.getPositionalArguments(), request)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/zope/publisher/publish.py", line 119, in mapply\n return debug_call(obj, args)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/zope/publisher/publish.py", line 126, in debug_call\n return obj(*args)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/_resource.py", line 954, in __call__\n result = self.do_GET()\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/_resource.py", line 1621, in do_GET\n result = self.handleCustomGET(operation_name)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/_resource.py", line 749, in handleCustomGET\n return operation()\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/_operation.py", line 94, in __call__\n response = self.call(**values)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/declarations.py", line 1655, in call\n result = self._getMethod()(**params)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/lib/lp/code/model/branch.py", line 854, in composePublicURL\n assert not (self.private and scheme in public_schemes), (\nAssertionError: Private branch ~<user>/<private bzr repository>/trunk has no public URL.\n'
---
You can report this problem to Breezy's developers by running
apport-bug /var/crash/brz.1000.2023-10-06T08:20.crash
if a bug-reporting window does not automatically appear.
</snip>
This issue _could_ be related to the issue(s) discussed in https://code.launchpad.net/~jelmer/launchpad/+git/launchpad/+merge/435608
Status changed to 'Confirmed' because the bug affects multiple users.