note: on june 7th i've torn down the bridge and ran it on a clean slate. i will check back on june 14th and provide a more detailed picture then
Bug Report: token refresh is not triggered causing need to re-login every ~7 days
Describe the bug
Some bridge paths do not recover when LINE returns an expired-access-token error. Users can end up needing to manually relogin after the access token
expires, commonly reported as every 7 days / 168 hours.
I recently hit this on my own bridge. The bridge process was still running and Matrix websocket reconnects were working, but an outbound Matrix -> LINE
send failed because LINE returned:
code=10051
TalkException code=119
reason="Access token refresh required"
The bridge already has refresh-token plumbing, but it appears to be applied inconsistently. In particular, the outbound send path can return the SendMessage auth error directly instead of refreshing the token and retrying once.
To Reproduce
- Login to LINE through the bridge.
- Keep the bridge running until the LINE access token expires, or otherwise trigger a LINE API call with an expired access token.
- Send a message from Matrix to LINE.
- Observe that the send fails with
Access token refresh required instead of refreshing and retrying automatically.
Expected behavior
The bridge should either:
- Refresh the LINE access token proactively before expiry using token metadata such as
durationUntilRefreshInSec, or
- Refresh and retry once when any LINE API call returns
code=119 / Access token refresh required.
The user should not need to manually relogin when a valid refresh token is available.
Screenshots or logs
Sanitized log excerpt from my bridge:
{"level":"error","action":"handle matrix event","event_type":"m.room.message","error":"API error 400: {\"code\":10051,\"message\":\"RESPONSE_ERROR\",
\"data\":{\"name\":\"TalkException\",\"message\":\"TalkException\",\"code\":119,\"reason\":\"Access token refresh required\",
\"parameterMap\":null}}","time":"2026-05-28T04:24:27.218385332Z","message":"Failed to handle Matrix message"}
{"level":"debug","action":"handle matrix event","status_code":200,"req_body":
{"status":"FAIL_RETRIABLE","reason":"m.event_not_handled","internal_error":"API error 400: {\"code\":10051,\"message\":\"RESPONSE_ERROR\",\"data\":
{\"name\":\"TalkException\",\"message\":\"TalkException\",\"code\":119,\"reason\":\"Access token refresh required\",
\"parameterMap\":null}}"},"time":"2026-05-28T04:24:28.133625047Z","message":"Request completed"}
Additional context
Relevant code:
Related discussion:
#162
Bug Report: token refresh is not triggered causing need to re-login every ~7 days
Describe the bug
Some bridge paths do not recover when LINE returns an expired-access-token error. Users can end up needing to manually relogin after the access token
expires, commonly reported as every 7 days / 168 hours.
I recently hit this on my own bridge. The bridge process was still running and Matrix websocket reconnects were working, but an outbound Matrix -> LINE
send failed because LINE returned:
The bridge already has refresh-token plumbing, but it appears to be applied inconsistently. In particular, the outbound send path can return the
SendMessageauth error directly instead of refreshing the token and retrying once.To Reproduce
Access token refresh requiredinstead of refreshing and retrying automatically.Expected behavior
The bridge should either:
durationUntilRefreshInSec, orcode=119/Access token refresh required.The user should not need to manually relogin when a valid refresh token is available.
Screenshots or logs
Sanitized log excerpt from my bridge:
{"level":"error","action":"handle matrix event","event_type":"m.room.message","error":"API error 400: {\"code\":10051,\"message\":\"RESPONSE_ERROR\", \"data\":{\"name\":\"TalkException\",\"message\":\"TalkException\",\"code\":119,\"reason\":\"Access token refresh required\", \"parameterMap\":null}}","time":"2026-05-28T04:24:27.218385332Z","message":"Failed to handle Matrix message"} {"level":"debug","action":"handle matrix event","status_code":200,"req_body": {"status":"FAIL_RETRIABLE","reason":"m.event_not_handled","internal_error":"API error 400: {\"code\":10051,\"message\":\"RESPONSE_ERROR\",\"data\": {\"name\":\"TalkException\",\"message\":\"TalkException\",\"code\":119,\"reason\":\"Access token refresh required\", \"parameterMap\":null}}"},"time":"2026-05-28T04:24:28.133625047Z","message":"Request completed"}Additional context
Relevant code:
RefreshAccessToken()calls LINE’s/api/auth/tokenRefreshendpoint:https://github.com/beeper/matrix-line-messenger/blob/main/pkg/line/client.go#L479
refreshAndSave()stores refreshed tokens:https://github.com/beeper/matrix-line-messenger/blob/main/pkg/connector/client.go#L143
recoverToken()refreshes first, then falls back to re-login:https://github.com/beeper/matrix-line-messenger/blob/main/pkg/connector/client.go#L192
isRefreshRequired()detectscode=119/Access token refresh required:https://github.com/beeper/matrix-line-messenger/blob/main/pkg/connector/client.go#L178
SendMessage:https://github.com/beeper/matrix-line-messenger/blob/main/pkg/connector/send_message.go#L630
errdirectly:https://github.com/beeper/matrix-line-messenger/blob/main/pkg/connector/send_message.go#L729
durationUntilRefreshInSec, but there does not appear to be a proactive refresh scheduler using it:https://github.com/beeper/matrix-line-messenger/blob/main/pkg/line/structs.go#L135
Related discussion:
#162