POST /instance/pair returns HTTP 500 for an already authenticated session, misleading Manager users
Maintainer thường phản hồi trong vòng 9 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- go
- Lĩnh vực
- api, backend-api-design
Hướng nghiên cứu
Start by reading pkg/instance/service/instance_service.go around Pair and pkg/instance/handler/instance_handler.go where Pair errors become HTTP responses. Find the existing tests for these paths and check how they handle an already authenticated client and genuine pairing failures. Done means regression coverage and a documented, distinguishable response for an authenticated session; the report notes that this specific case is not yet reproduced on an unmodified build.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Welcome!
- I searched existing issues and did not find the same already-authenticated-session HTTP 500 case. Related but different: #21 and #225.
What did you do? / Problem description
After recreating the application container with connection fixes adapted from #199, preserving PostgreSQL data and the existing WhatsApp session, I used Manager to connect that instance and request a phone pairing code.
POST /instance/pair returned HTTP 500 although the existing session had already authenticated and subsequently appeared connected. Manager presented the pairing attempt as a failure, which suggested that the connection was still broken.
Observed steps
- Start the locally modified application against the existing persistent database/session.
- In Manager, connect the instance and request a phone pairing code.
- Observe
/instance/connectreturning 200, successful session authentication, and/instance/pairreturning 500. - Refresh Manager: the instance is connected. A subsequent API status check reports
Connected: trueandLoggedIn: true. - Send a text through the API: HTTP 200 on the first attempt, delivery receipts logged, and receipt confirmed by the recipient.
No new pairing was required: the existing session recovered after the container restart. This sequence was observed once; deterministic reproduction on an unmodified official build is still needed.
What did you expect?
An already authenticated session should be distinguished from a genuine internal or PairPhone failure. Manager should refresh the status and explain that pairing is unnecessary rather than present a generic error. A valid session should not need to be logged out or deleted to clear that error.
What did you observe instead?
POST /instance/pair returned HTTP 500 while the session was successfully authenticated. The instance subsequently connected and could send messages normally.
Evidence limit: we did not capture the HTTP response body of that particular pairing request. The already-authenticated branch described below is a suspected cause based on source inspection, not a confirmed response-body assertion.
Screenshots / videos
No media attached; the timestamped log sequence and subsequent API test are provided below.
Which version are you using?
Locally modified image based on stable 0.7.2, revision 9337afc47e10b86cc896a6f432240e40fee95dd1.
- Connection fixes adapted from #199.
- Whatsmeow revision
adccd15f71bbcf81efe537d86ab8b251d9c230e2, from evolution-foundation/whatsmeow#5. - The stable QR/passkey flow was preserved.
- This exact scenario has not been reproduced on an unmodified official image. The relevant Pair handler/service branches were not changed by our patch.
What is your environment?
Linux (Ubuntu), Docker Compose, PostgreSQL 16. Application compiled in Docker with Go 1.27.1. Tests, go vet and build passed before deployment.
Relevant log output
Observed on 02 November 2026 (UTC); identifiers and personal data omitted:
- 23:48:42.067 —
POST /instance/connectreturned 200. - 23:48:42.150 —
WhatsApp handshake version: 2.3000.1052747707. - 23:48:42.150 —
Already logged in with JID: [REDACTED]. - 23:48:42.541 —
Successfully authenticated. - 23:48:43.329 —
POST /instance/pairreturned 500. - 23:48:43.828 —
events.Connected to Whatsapp.
Later validation confirmed Connected: true, LoggedIn: true, successful text sending and receipt by the recipient.
Additional notes
Suspected root cause
In pkg/instance/service/instance_service.go, Pair returns instance is already authenticated when client.IsLoggedIn() is true. In pkg/instance/handler/instance_handler.go, every error from instanceService.Pair is mapped to HTTP 500. An expected session state is therefore classified as an internal failure by that code path.
The log chronology is consistent with this branch, but the missing response body limits certainty about this specific request.
Proposed solution
- Distinguish already-authenticated sessions from genuine internal/PairPhone errors using a typed/sentinel error or equivalent.
- Return a documented response, e.g. HTTP 409 with a stable
already_authenticatedcode, or an explicitly documented idempotent success response. - Have Manager refresh instance status and explain that no new pairing is required.
- Add regression coverage for the already-authenticated branch and preserve normal handling of genuine pairing errors.
Related
- Connection-fix validation: https://github.com/evolution-foundation/evolution-go/pull/199#issuecomment-6605786038
- #225 concerns the separate
Client outdated (405)handshake problem. - #21 concerns an empty pairing code with HTTP 200, not this HTTP 500 case.
No credentials, phone numbers or message contents are included.
- Ngôn ngữ chính
- Go
- Star
- 1k
- Fork
- 610
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của evolution-foundation/evolution-go
-
/user/info and /user/avatar hang for 75s when number is a phone numberCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
evolution-foundation/evolution-go#223 ·
Maintainer thường phản hồi trong vòng 9 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
evolution-foundation/evolution-go#193 ·
Maintainer thường phản hồi trong vòng 9 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
evolution-foundation/evolution-go#104 ·
Maintainer thường phản hồi trong vòng 9 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
evolution-foundation/evolution-go#101 ·
Maintainer thường phản hồi trong vòng 9 ngày
-
POST /group/participant always returns 400 "participants is required and cannot be empty" (wrong validation middleware on route)Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
evolution-foundation/evolution-go#97 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 9 ngày
Tất cả issue của evolution-foundation/evolution-go
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
kaiachain/kaia#1143 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation factory:ready
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
good first issue spec
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
-
Go - Inconsistent Logs StabilityĐang mởdocs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
open-telemetry/opentelemetry.io#12846 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày