Skip to content
This repository was archived by the owner on Jul 22, 2026. It is now read-only.
This repository was archived by the owner on Jul 22, 2026. It is now read-only.

GET /model/controller/api BAD Request 400 #1274

Description

@Deezzir

Description

The library failed to connect to the controller with 400 HTTP code

File "/var/lib/juju/agents/unit-juju-backup-all-1/charm/venv/juju/controller.py", line 641, in get_model
    await model._connect_direct(**kwargs)
  File "/var/lib/juju/agents/unit-juju-backup-all-1/charm/venv/juju/model/__init__.py", line 837, in _connect_direct
    await self._connector.connect(**kwargs)
  File "/var/lib/juju/agents/unit-juju-backup-all-1/charm/venv/juju/client/connector.py", line 107, in connect
    self._connection = await Connection.connect(**kwargs)
  File "/var/lib/juju/agents/unit-juju-backup-all-1/charm/venv/juju/client/connection.py", line 261, in connect
    await self._connect_with_redirect([_ep])
  File "/var/lib/juju/agents/unit-juju-backup-all-1/charm/venv/juju/client/connection.py", line 832, in _connect_with_redirect
    login_result = await self._connect_with_login(endpoints)
  File "/var/lib/juju/agents/unit-juju-backup-all-1/charm/venv/juju/client/connection.py", line 800, in _connect_with_login
    await self._connect(endpoints)
  File "/var/lib/juju/agents/unit-juju-backup-all-1/charm/venv/juju/client/connection.py", line 743, in _connect
    result = await task
  File "/usr/lib/python3.10/asyncio/tasks.py", line 571, in _wait_for_one
    return f.result()  # May raise f.exception().
  File "/var/lib/juju/agents/unit-juju-backup-all-1/charm/venv/juju/client/connection.py", line 729, in _try_endpoint
    return await self._open(endpoint, cacert)
  File "/var/lib/juju/agents/unit-juju-backup-all-1/charm/venv/juju/client/connection.py", line 333, in _open
    await websockets.connect(
  File "/var/lib/juju/agents/unit-juju-backup-all-1/charm/venv/websockets/asyncio/client.py", line 543, in __await_impl__
    await self.connection.handshake(
  File "/var/lib/juju/agents/unit-juju-backup-all-1/charm/venv/websockets/asyncio/client.py", line 114, in handshake
    raise self.protocol.handshake_exc
  File "/var/lib/juju/agents/unit-juju-backup-all-1/charm/venv/websockets/client.py", line 325, in parse
    self.process_response(response)
  File "/var/lib/juju/agents/unit-juju-backup-all-1/charm/venv/websockets/client.py", line 142, in process_response
    raise InvalidStatus(response)

Some debug logs:

2025-04-23 10:32:04,331 INFO jujubackupall.backup [juju-3-5-ctrl] Attempt #1 for controller backup.
2025-04-23 10:32:04,331 DEBUG websockets.client > TEXT '{\n  "type": "ModelManager",\n  "request": "Lis...\n  "request-id": 20\n}' [171 bytes]
2025-04-23 10:32:04,355 DEBUG websockets.client < TEXT '{"request-id":20,"response":{"results":[{"resul...version":"3.5.4"}}]}}\n' [714 bytes]
2025-04-23 10:32:04,358 DEBUG websockets.client = connection is CONNECTING
2025-04-23 10:32:04,368 DEBUG websockets.client > GET /model/controller/api HTTP/1.1
2025-04-23 10:32:04,368 DEBUG websockets.client > Host: 10.169.129.133:17070
2025-04-23 10:32:04,368 DEBUG websockets.client > Upgrade: websocket
2025-04-23 10:32:04,368 DEBUG websockets.client > Connection: Upgrade
2025-04-23 10:32:04,368 DEBUG websockets.client > Sec-WebSocket-Key: FEDyzd+Bef3hsnqP6uhUwA==
2025-04-23 10:32:04,368 DEBUG websockets.client > Sec-WebSocket-Version: 13
2025-04-23 10:32:04,368 DEBUG websockets.client > Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
2025-04-23 10:32:04,368 DEBUG websockets.client > User-Agent: Python/3.10 websockets/15.0.1
2025-04-23 10:32:04,369 DEBUG websockets.client < HTTP/1.1 400 Bad Request
2025-04-23 10:32:04,369 DEBUG websockets.client < Content-Type: text/plain; charset=utf-8
2025-04-23 10:32:04,369 DEBUG websockets.client < X-Content-Type-Options: nosniff
2025-04-23 10:32:04,369 DEBUG websockets.client < Date: Wed, 23 Apr 2025 10:32:04 GMT
2025-04-23 10:32:04,369 DEBUG websockets.client < Content-Length: 32
2025-04-23 10:32:04,369 DEBUG websockets.client < [body] (32 bytes)
2025-04-23 10:32:04,369 DEBUG websockets.client > EOF
2025-04-23 10:32:04,369 DEBUG websockets.client x closing TCP connection
2025-04-23 10:32:04,370 DEBUG websockets.client < EOF
2025-04-23 10:32:04,370 DEBUG websockets.client = connection is CLOSED
2025-04-23 10:32:04,370 DEBUG websockets.client > CLOSE 1000 (OK) [2 bytes]
2025-04-23 10:32:04,370 DEBUG websockets.client = connection is CLOSING
2025-04-23 10:32:04,371 DEBUG websockets.client < CLOSE 1000 (OK) [2 bytes]
2025-04-23 10:32:04,371 DEBUG websockets.client < EOF
2025-04-23 10:32:04,371 DEBUG websockets.client > EOF
2025-04-23 10:32:04,371 DEBUG websockets.client = connection is CLOSED
2025-04-23 10:32:04,374 DEBUG __main__ writing error details to the results file
2025-04-23 10:32:04,375 ERROR __main__ backup failed! check log for details

Reference: canonical/charm-juju-backup-all#86

Urgency

Client presentation, help now please!

Python-libjuju version

3.6.1.1

Juju version

3.5.4

Reproduce / Test

Run the latest/stable charm, rev70 charm-juju-backup-all on a Juju controller with version 3.5.4

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugindicates a bug in the project

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions