d devhelper

← All errors

Data problem

RuntimeError

Request error (HTTP 422): organization_name: Either organization_name or first + last name must be set [requestId: <secret>]

FailedCandidClaimResubmissionJob@billing463 events · 0 users first seen 43 d agolast seen 9 h ago

In one line

Candid rejects the claim with a 422 because the billing provider it receives has no organization_name and no first/last name, and our code reports each rejection to Bugsnag as a warning.

Checked against the code

What happened

  • The nightly billing job (about 3am) submits encounters to Candid. Candid answers HTTP 422: the provider needs an organization_name or a first and last name.
  • The mapper builds billing_provider from the Candid provider record for the program's claims_billing_provider_uuid. It uses organization_name and drops nils with .compact, so a record without a name sends an empty name.
  • handle_submission_error calls Bugsnag.notify on purpose, so this is a deliberate warning and not a crash.
  • There are 1181 events over 43 days with 0 users. That fits the same few entries failing and being retried every night, not a deploy blip.

What to do next

  1. Query Lists the billing provider UUIDs configured per program so you can check each one in Candid for a missing organization_name.
    SELECT program_id, claims_billing_provider_uuid FROM program_settings WHERE claims_billing_provider_uuid IS NOT NULL;
  2. Check In the Candid dashboard, open the organization provider for each UUID from the query above. Make sure the failing one has an organization_name, or first and last name, and fix it there. Also confirm the rendering provider NPI record is complete.
  3. Code fix In app/lib/candid_health/care_management_claim_mapper.rb, add a validation step for the billing provider. If the record has no organization_name and no first_name plus last_name, return a mapper validation error (the path that calls record_validation_failure) with a clear message. Do this before submitting to Candid.

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.04