Freika/dawarich · warning
[MapChannel] Failed to subscribe to tracks channel:
Error message
[MapChannel] Failed to subscribe to tracks channel:
What it means
The map also subscribes to TracksChannel so finished background track calculations appear without a refresh. Like the other channel subscriptions, a synchronous throw during consumer.subscriptions.create is caught and logged with this warning; the map continues without live track updates, then setupMapChannels returns its unsubscribe handles.
Source
Thrown at app/javascript/maps_maplibre/channels/map_channel.js:126
},
disconnected() {
console.log("TracksChannel disconnected")
callbacks.disconnected?.("tracks")
},
received(data) {
console.log("TracksChannel received:", data)
callbacks.received?.({
type: "track_update",
action: data.action,
track: data.track,
track_id: data.track_id,
})
},
})
} catch (error) {
console.warn("[MapChannel] Failed to subscribe to tracks channel:", error)
}
return {
subscriptions,
unsubscribeAll() {
Object.values(subscriptions).forEach((sub) => {
sub?.unsubscribe()
})
},
}
}
View on GitHub (pinned to 97fad417c5)
Solutions
- Verify the /cable WebSocket connects (101 status) in the Network tab
- Align the channel identifier string with the Rails channel class name after upgrades
- Ensure proxy WebSocket upgrade configuration covers the cable mount path
- Cache-bust the JS bundle after backend channel changes
Example fix
// before
subscriptions.tracks = consumer.subscriptions.create("TracksChannel", { ...handlers })
// after
try {
subscriptions.tracks = consumer.subscriptions.create("TracksChannel", {
rejected() { console.warn("[MapChannel] Tracks channel rejected subscription") },
...handlers,
})
} catch (error) {
console.warn("[MapChannel] Failed to subscribe to tracks channel:", error)
} Defensive patterns
Strategy: try-catch
Validate before calling
if (!consumer || typeof consumer.subscriptions?.create !== "function") return
Try / catch
try {
subscriptions.tracks = consumer.subscriptions.create("TracksChannel", {
rejected() { console.warn("[MapChannel] Tracks channel rejected subscription") },
...handlers,
})
} catch (error) {
console.warn("[MapChannel] Failed to subscribe to tracks channel:", error)
// Track updates simply stop being live; manual refresh still works
} Prevention
- Keep channel identifier strings in one constants module shared with backend naming after upgrades
- Test the cable path behind the same proxy configuration as production
- Cache-bust frontend bundles after backend channel renames
When it happens
Trigger: Cable endpoint unreachable or blocked by the proxy; consumer in a bad state throwing on create; the TracksChannel identifier string not matching the Rails channel after a rename or namespacing change; subscription attempted while a previous cable connection is mid-reconnect and failing.
Common situations: WebSocket-incompatible proxies in front of self-hosted instances; backend upgrades renaming TracksChannel; authorization changes rejecting subscription creation; stale cached assets after deploy.
Related errors
- [MapChannel] Failed to subscribe to family channel:
- [MapChannel] ActionCable consumer not available
- [MapChannel] Failed to subscribe to points channel:
- [Realtime Controller] Maps controller not found
- [Realtime Controller] Points layer not found
AI-assisted analysis of Freika/dawarich@97fad417c5 (2026-08-21).
Data as JSON: /api/errors/7776278503a5a9c5.
Report an issue: GitHub.