Skip to content

[BUG]: Reactivating gateway logs warning due to dict as Pydantic model #28

@crivetimihai

Description

@crivetimihai

🐞 Bug Summary

When reactivating a previously deactivated gateway from the Admin UI, the backend logs the following warning:


WARNING - Failed to initialize reactivated gateway: 'dict' object has no attribute 'dict'

Despite the warning, the reactivation succeeds — the gateway is re-enabled and all associated tools are reactivated correctly.


🧩 Affected Component

  • mcpgateway – Backend (gateway reactivation logic)
  • Admin UI (HTMX)
  • Federation or Transports
  • CLI, Makefiles, or shell scripts
  • Container setup (Docker/Podman/Compose)

🔁 Steps to Reproduce

  1. Go to Admin > Gateways
  2. Deactivate a gateway
  3. Enable "Show Inactive"
  4. Click "Activate" on the previously deactivated gateway
  5. Check logs

🤔 Expected Behavior

Reactivation should complete cleanly, and logs should not show any warnings or exceptions. If the code expects a Pydantic model (.dict()), it should validate or convert the input accordingly.


📓 Logs / Error Output

2025-06-02 15:11:18,459 - mcpgateway.services.gateway_service - WARNING - Failed to initialize reactivated gateway: 'dict' object has no attribute 'dict'
2025-06-02 15:11:18,471 - mcpgateway.services.tool_service - INFO - Tool echo activated
2025-06-02 15:11:18,477 - mcpgateway.services.tool_service - INFO - Tool get_current_time activated

🧩 Additional Context (optional)

The issue likely originates from this logic in gateway_service.toggle_gateway_status:

gateway.capabilities = capabilities.dict()

…but capabilities is already a dictionary in this context. A simple type check or explicit model conversion should resolve this cleanly.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingfrontendFrontend development (HTML, CSS, JavaScript)good first issueGood for newcomershelp wantedExtra attention is neededpythonPython / backend development (FastAPI)

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions