Repository navigation
Troubleshooting
Jeffrie Budde edited this page Nov 25, 2025
·
1 revision
Quick fixes for common FastRMCP issues. See Observability for logging tips.
-
SSE: 400 Bad Request on POST — Include
"connectionId"from the first SSE event in every POST; if multiple clients connect without IDs, the server rejects ambiguous requests. -
WebSocket server-initiated messages go nowhere — Set
metadata.connectionIdin the request params to target a specific connection; otherwise only the current connection receives it. -
Port conflicts — Change example ports (3000/3001) or kill processes (
lsof -ti:3000 | xargs kill).
-
"Invalid params" — Ensure tool/resource structs derive
Serialize+Deserialize; check argument names match signature (case-sensitive). -
Optional fields — Use
Option<T>for optional params; sendingnullmaps toNone. -
URI template mismatch — Resource URIs must match patterns exactly (e.g.,
file:///tmp/a.txtvsfile:///{path}); overlapping templates causeServerError -32002.
-
Missing client info — Provide
clientInfoduringinitialize;Context.client_infowill beNoneotherwise. -
Progress/logs not visible — Use transports that support notifications (SSE/WS) and ensure the client listens for
notifications/progress/notifications/message. STDIO still logs viatracingfallback.
-
No notifications — Verify you call
notify_uriwith validResourceContentand subscribers exist (subscription_count_for_uri > 0). Check transport connectionId handling (SSE) or connection targeting (WS). - Stale subscriptions after restart — Recreate subscriptions from persisted state or ask clients to resubscribe; manager does not persist by default.
-
Unexpected rejections — Logging middleware first helps reveal which middleware returns errors. Remember order is the same as added for
before_requestand reversed forafter_response. -
Auth always fails — Inspect
request.params["metadata"]contents; browser clients may strip headers unless CORS allows them.
- Enable verbose logs:
RUST_LOG=fastrmcp=debug,tower_http=debug cargo run --features full. - Replay with
examples/completeto isolate framework vs. app-level issues. - Validate JSON-RPC shape with
jqorjsonlintbefore sending. - Check registry contents at startup:
server.tool_registry().list()?etc. to confirm macros registered.
Related: Transports Guide • Subscriptions • Middleware Cookbook.