Actions
Bug #844
open
AV
FM
Order procedure fails with "pharmacy is unreachable" for every pricing error, returns 422, and offers no way to continue
Bug #844:
Order procedure fails with "pharmacy is unreachable" for every pricing error, returns 422, and offers no way to continue
Start date:
11/12/2026
Due date:
% Done:
0%
Estimated time:
Resolved By:
Description
Ordering a procedure whose type has charged items fails with a generic "pharmacy is unreachable" message. The code turns every failure of the price lookup into this message, returns it as a 422 (invalid input) when a dependency failed, and tells the doctor to "order it without the charged items" when the dialog has no such option.
Steps to Reproduce:
- Log in as Dr. Sravan VS (Vetri Vivega Medical Center) and open a consultation (e.g. /doctor/consultation/399, patient amal prasad).
- Go to the Procedures tab and open Order procedure.
- Select Procedure type = Inpatient Procedure (Rs 500.00), Priority = Routine, and click Create order.
Expected Result:
- The order is created, or the doctor sees an error that names the real problem (Pharmacy down, no price for an item, not enough stock).
- A failed dependency returns a 502/503, not a 422.
- If the message offers "order without the charged items", the dialog provides that option.
Actual Result:
- Toast: "Could not price this procedure's charged items because pharmacy is unreachable. Try again, or order it without the charged items."
- POST /doctor/api/opd/proxy?path=/api/minor-procedures returns 422 Unprocessable Entity, DomainValidationException, details: null.
- errorId 2349fe6e-4f1d-4035-ab15-03b4be29c6b4, traceId 0HNQ0GPRPE4AA:00000001, 2026-11-12 09:39:05 UTC.
- No order is created. The dialog has no way to order without the charged items, so the procedure cannot be ordered while Pharmacy has a problem.
Notes:
- Code: PreflightChargedItemsAsync in nuvita-opd MinorProcedureService.cs (~line 717-724). GetEstimatedUnitPricesAsync is wrapped in catch (Exception), and everything becomes the same "unreachable" message. A 401/403, a 500 from Pharmacy, a wrong Pharmacy:BaseUrl and a real outage look identical to the user. The original exception is only attached as the inner exception. The stock check below it ("Could not check {store} stock ... pharmacy is unreachable") has the same pattern.
- Root cause of this particular failure is pending. Search the OPD API log on the test server for the errorId above to read the inner exception, and check that the Pharmacy service is running on test with the right base URL and service auth. If it is only a test-environment configuration problem, this ticket still stands for the handling issues, but priority can drop to Normal.
- Suggested fixes:
- Treat only transport and timeout failures as "unreachable". Log the inner exception and give distinct messages for auth and server errors.
- Return 502/503 for a dependency failure, not 422, and include a useful reason in details.
- Either add an "order without charged items" option to the dialog or remove that wording from the message.
- This is OPD's shared code, so the fix reaches Doctor Desktop on the next npm run sync:opd.
Files
AV Updated by Alminta V. about 14 hours ago
AV Updated by Alminta V. about 14 hours ago
- Assignee set to Fiza M.
Actions