d devhelper

← All errors

Data problem

Medplum::Eprescribe::UpstreamError

ScriptSure patient sync failed: Multiple ScriptSure practices are available for this prescriber; specify an organizationId to choose one. Candidates: Organization/<secret>, Organization/<secret>, Organization/<secret>

v1/eprescribe#launch2 events · 1 users first seen 5 d agolast seen 23 h ago

In one line

The patient sync bot ran without an organizationId, so ScriptSure refused to pick between the prescriber's 3 practices; the service handled it as designed and sent a warning to Bugsnag.

Checked against the code

What happened

  • sync_patient! sends organizationId only if the prescriber has 2 or more practices in Medplum and one matches the patient's state (organization_params).
  • If the patient's state is blank or unmatched, the code logs a warning and sends no organizationId. The same happens if the cached practice list has under 2 entries.
  • ScriptSure sees 3 organizations for this prescriber and rejects the call as ambiguous. The controller rescues the UpstreamError, calls Bugsnag.notify on purpose, and returns 422.
  • Only 3 events for 2 users over 5 days points to a few specific prescriber/patient combinations, not a systemic bug or a deploy problem.

What to do next

  1. Check Search the logs for '[Eprescribe] No ScriptSure practice for the patient's state' at the event times (2026-11-05 17:39 and 2026-11-10 13:06). This shows whether the patient's state was blank or unmatched, or whether the prescriber has fewer than 2 practices in Medplum.
  2. Check Compare the prescriber's state credentials in Medplum with their ScriptSure organizations (3). Add the missing state practices, or fix the affected patients' resident state and address.
  3. Check Decide what to do when no practice matches the patient's state: keep the current behaviour (send no organizationId and rely on ScriptSure's default), or block with a clear 'choose a practice' message. This needs a product decision before any code change.

Queries are shown, never run. Check them before using them on production.

Ask a follow-up

Continues the same session, so it still remembers the error and the code it read.

Enter to send · Shift+Enter for a new line
Analysed 1 h ago · claude-sonnet-5-5 · $0.05