Membership API Error Handling Guide

Membership API Error Handling Guide

Overview

This document provides comprehensive guidance for handling errors returned by the ICHRA Membership API. It is intended for developers integrating with Oscar's ICHRA API and serves as the authoritative reference for error codes, their meanings, and recommended handling strategies.

Purpose

When your API requests encounter issues, the Membership API returns structured error responses with machine-readable error codes. This guide helps you:

  1. Understand error responses - Learn the structure and fields of error responses
  2. Categorize errors - Determine whether an error is fixable, retryable, or requires escalation
  3. Implement error handling - Build robust error handling logic in your integration
  4. Resolve issues quickly - Use the error code reference to diagnose and fix problems

How to Use This Guide

  • During development: Reference the Error Code Reference section to understand specific errors you encounter
  • When building integrations: Use the Error Categories section to implement proper error handling logic
  • For transient failures: Follow the Retry Strategy section for handling temporary errors
  • When contacting support: Include the application_id and error_code from your error response

Quick Reference

I need to...Go to section
Understand an error codeError Code Reference
Know if I should retryError Categories
Implement retry logicRetry Strategy
See example responsesExample Error Responses
Add error handling codeHandling Errors in Code

Applicable Endpoints

This guide covers error handling for the ICHRA Membership API endpoints:

  • POST /memberships/create-membership
  • POST /memberships/update-membership

Error Response Structure

All processing errors return a consistent JSON structure:

{
  "application_id": "123abc987def456fed789cba432bcdaa",
  "enrollees": [],
  "message": "The request could not be processed due to validation errors.",
  "errors": [
    {
      "error_code": "INVALID_SSN_FORMAT",
      "message": "The SSN provided is invalid. Please verify and resubmit."
    }
  ]
}

Response Fields

FieldTypeDescription
application_idstring | nullThe enrollment ID for this request. Retain this value for troubleshooting with Oscar support. May be null if the error occurred before enrollment creation.
enrolleesarrayEmpty array on error responses.
messagestringHuman-readable summary of the error category.
errorsarrayList of structured error objects (see below).

Error Object Fields

FieldTypeDescription
error_codestringMachine-readable error code for programmatic handling.
messagestringHuman-readable description of the specific error.

Note: The field property is not included in error responses. Use the error_code and message to identify and resolve issues.

Error Categories

Errors are classified into three categories based on the HTTP status code returned:

CategoryHTTP CodeDescriptionAction
ACTIONABLE400Validation or data errors that can be fixed by the clientFix the request data and retry
RETRY503Transient errors due to temporary conditionsRetry with exponential backoff
ESCALATE500Internal errors requiring Oscar interventionContact Oscar support with application_id

Retry Strategy

When to Retry

Only retry requests that return HTTP 503 with RETRY category errors:

Error CodeRetry?Strategy
ACTIONABLE (400)NoFix request data first
RETRY (503)YesExponential backoff
ESCALATE (500)NoContact Oscar support

Recommended Retry Logic

import time
import random

def retry_with_backoff(request_func, max_retries=3):
    """Retry a request with exponential backoff."""
    for attempt in range(max_retries):
        response = request_func()

        if response.status_code != 503:
            return response

        # Exponential backoff with jitter
        wait_time = (2 ** attempt) + random.uniform(0, 1)
        time.sleep(wait_time)

    return response  # Return last response after all retries
AttemptWait Time
11-2 seconds
22-3 seconds
34-5 seconds

Error Code Reference

Request Validation Errors

These errors indicate problems with the request format or field values.

Error CodeMessageResolution
INVALID_REQUEST_FORMATThe request contains invalid data. Please review and correct the submission.Review the request structure against the API specification.
MISSING_REQUIRED_FIELDA required field is missing.Check the error message for details on the missing field.
INVALID_FIELD_VALUEThe field value is invalid.Verify the field value matches the expected format or enum.
INVALID_DATE_FORMATThe date format is invalid.Use YYYY-MM-DD format for all dates.
INVALID_EMAIL_FORMATThe provided email address is invalid.Verify the email address format.
INVALID_SSN_FORMATThe SSN provided is invalid. Please verify and resubmit.Ensure SSN is 9 digits without dashes.
INVALID_PHONE_FORMATThe phone number format is invalid.Use a valid phone number format.
INVALID_ADDRESSThe address is invalid.Verify all address fields are complete and valid.
INVALID_RELATIONSHIP_TYPEThe relationship type is invalid.Use a valid relationship type enum value.
INVALID_STATE_CODEThe state code is invalid.Use a valid 2-letter state code.
INVALID_ZIPCODEThe zipcode is invalid.Use a valid 5-digit or 9-digit zipcode.
DUPLICATE_SSNPolicy holder and dependents must have unique SSNs.Ensure each enrollee has a unique SSN.
INVALID_HIOS_IDThe specified hios_id is not valid for ICHRA enrollments.Verify the hios_id and ensure the plan is available.

Member/Contract Lookup Errors

These errors indicate problems finding or matching member records.

Error CodeMessageResolution
MEMBER_NOT_FOUNDCould not match the member to an existing record.Verify the member information (name, DOB, SSN) is correct.
CONTRACT_NOT_FOUNDNo coverage found for this member.Verify the oscar_id and coverage dates are correct.
POLICY_NOT_FOUNDUnable to determine the policy for this enrollment.Verify the hios_id and plan_year are correct.
DEPENDENT_NOT_FOUNDThe dependent was not found.Verify the dependent information is correct.
MEMBER_NOT_ON_CONTRACTThe specified member is not part of this coverage.Verify the member is enrolled on the specified contract.
OSCAR_ID_MISMATCHThe Oscar ID does not match the expected value.Verify the oscar_id format (OSCXXXXXXXX-XX).
MULTIPLE_MEMBERS_FOUNDMultiple members found matching the provided information.Contact Oscar support to resolve the duplicate.

Date/Coverage Period Errors

These errors indicate problems with dates or coverage periods.

Error CodeMessageResolution
DATE_OUTSIDE_CONTRACT_PERIODThe date is outside the contract coverage period.Ensure dates fall within the member's coverage period.
COVERAGE_START_DATE_INVALIDThe coverage start date cannot be after the coverage end date.Verify coverage_start_date is before coverage_end_date.
COVERAGE_END_DATE_INVALIDThe coverage end date is invalid.Verify the coverage end date is valid.
PREMIUM_DATES_OUTSIDE_COVERAGEPremium dates are outside the coverage period.Ensure premium dates align with coverage dates.
EFFECTIVE_DATE_IN_PASTThe effective date is in the past.Use a current or future effective date.
COVERAGE_DATES_OVERLAPCoverage dates overlap with existing coverage.Adjust dates to avoid overlap.
INVALID_PLAN_YEARThe plan year is invalid.Use a valid plan year (e.g., "2025").
EVENT_DATE_OUTSIDE_QLE_WINDOWThe event date is outside the qualifying life event window.Verify the QLE date is within the allowed window.
MISSING_QUALIFYING_EVENTA qualifying life event is required to change this policy outside of Open Enrollment.Include a qle_info block with the event type and date.
INVALID_COVERAGE_START_DATE_FOR_QLEThe coverage start date is not valid for the provided qualifying life event. The message lists the valid coverage start dates.Set the coverage start date to one of the valid dates listed in the message.
QLE_HAS_NO_VALID_COVERAGE_DATESThe provided qualifying life event has no valid coverage effective dates (e.g., the QLE is not valid in the state, or the application/QLE date is outside the enrollment window).Verify the QLE type and that the QLE and application dates fall within the special enrollment period.

Financial/Premium Errors

These errors indicate problems with premium or financial data.

Error CodeMessageResolution
INVALID_PREMIUM_AMOUNTThe premium amount is invalid.Verify the premium amount format and value.
PREMIUM_AMOUNT_MISMATCHThe premium amount does not match expected value.Verify the total_premium matches the plan's premium.
MISSING_PREMIUM_DATARequired premium data is missing.Include all required premium fields.
PREMIUM_OUT_OF_RANGEThe premium amount is outside the valid range.Verify the premium amount is reasonable.

Relationship/Dependent Errors

These errors indicate problems with enrollee relationships or dependent eligibility.

Error CodeMessageResolution
INVALID_DEPENDENT_RELATIONSHIPThe dependent relationship type is invalid.Use a valid relationship_type enum value.
DEPENDENT_AGE_LIMIT_EXCEEDEDThe dependent has exceeded the age limit for coverage.Dependents must be under 26 years old.
DUPLICATE_DEPENDENTA duplicate dependent was found.Remove duplicate enrollees from the request.
POLICY_HOLDER_REQUIREDA policy holder is required in the enrollment request.Include an enrollee with relationship_type "POLICY_HOLDER".
MULTIPLE_SPOUSES_NOT_ALLOWEDOnly one spouse is allowed per policy.Include only one enrollee with relationship_type "SPOUSE".
POLICY_HOLDER_TOO_YOUNGThe policy holder does not meet age requirements.Policy holder must be at least 18 years old.

Address/Service Area Errors

These errors indicate problems with address validation or service area eligibility.

Error CodeMessageResolution
ADDRESS_NOT_IN_SERVICE_AREAThe member's address is not in the service area for this policy.Verify the address is in Oscar's service area for the selected plan.
ADDRESS_NOT_IN_RATING_AREAThe member's address is not in a valid rating area for this policy.Verify the address matches the plan's rating area.
ADDRESS_VERIFICATION_FAILEDUnable to verify the address. An exact match was not found.Verify the address is complete and correctly formatted.

Transient Errors - RETRY

These errors are temporary and should be retried with exponential backoff.

Error CodeMessageResolution
SERVICE_TEMPORARILY_UNAVAILABLEThe service is temporarily unavailable. Please try again.Retry the request after a short delay.
REQUEST_TIMEOUTThe request timed out. Please try again.Retry the request after a short delay.
UPSTREAM_SERVICE_ERRORAn upstream service error occurred.Retry the request after a short delay.

Internal Errors - ESCALATE

These errors require Oscar intervention. Contact Oscar support with the application_id.

Error CodeMessageResolution
INTERNAL_PROCESSING_ERRORAn internal error occurred. Please contact Oscar support.Contact Oscar support with the application_id.
ELIGIBILITY_CONFLICTAn eligibility conflict was detected. Please contact Oscar support.Contact Oscar support to resolve the conflict.
DATA_INTEGRITY_ERRORA data integrity error occurred.Contact Oscar support with the application_id.
PERMISSION_DENIEDPermission denied. Please contact Oscar support.Contact Oscar support to verify permissions.

Example Error Responses

Validation Error (400)

{
  "application_id": null,
  "enrollees": [],
  "message": "The request could not be processed due to validation errors.",
  "errors": [
    {
      "error_code": "INVALID_SSN_FORMAT",
      "message": "The SSN provided is invalid. Please verify and resubmit."
    },
    {
      "error_code": "INVALID_DATE_FORMAT",
      "message": "The date format is invalid."
    }
  ]
}

Member Not Found (400)

{
  "application_id": "abc123def456789012345678abcdef12",
  "enrollees": [],
  "message": "The request could not be processed due to validation errors.",
  "errors": [
    {
      "error_code": "MEMBER_NOT_FOUND",
      "message": "Could not match the member to an existing record."
    }
  ]
}

Service Unavailable (503)

{
  "application_id": null,
  "enrollees": [],
  "message": "The service is temporarily unavailable. Please retry.",
  "errors": [
    {
      "error_code": "SERVICE_TEMPORARILY_UNAVAILABLE",
      "message": "There are pending transactions for this member. Please try again later."
    }
  ]
}

Internal Error (500)

{
  "application_id": "def456abc789012345678901fedcba98",
  "enrollees": [],
  "message": "An error occurred processing your request.",
  "errors": [
    {
      "error_code": "ELIGIBILITY_CONFLICT",
      "message": "An eligibility conflict was detected. Please contact Oscar support."
    }
  ]
}

Handling Errors in Code

Python Example

import requests

def update_membership(request_data):
    response = requests.post(
        "https://ichra-api.hioscar.com:444/ichra-api/v1/memberships/update-membership",
        json=request_data,
        cert=("client.crt", "client.key"),
    )

    if response.status_code == 200:
        return response.json()

    error_response = response.json()

    # Handle by category
    if response.status_code == 400:
        # ACTIONABLE: Fix the request
        for error in error_response.get("errors", []):
            print(f"Fix {error['error_code']}: {error['message']}")
        raise ValueError("Request validation failed")

    elif response.status_code == 503:
        # RETRY: Transient error
        raise RetryableError("Service temporarily unavailable")

    elif response.status_code == 500:
        # ESCALATE: Contact Oscar support
        app_id = error_response.get("application_id")
        raise InternalError(f"Contact Oscar support. Application ID: {app_id}")

    else:
        raise Exception(f"Unexpected error: {response.status_code}")

JavaScript Example

async function updateMembership(requestData) {
  const response = await fetch(
    'https://ichra-api.hioscar.com:444/ichra-api/v1/memberships/update-membership',
    {
      method: 'POST',
      headers: {'Content-Type': 'application/json'},
      body: JSON.stringify(requestData),
    },
  );

  const data = await response.json();

  if (response.ok) {
    return data;
  }

  // Handle by status code
  switch (response.status) {
    case 400:
      // ACTIONABLE: Log errors for fixing
      data.errors.forEach((error) => {
        console.error(`${error.error_code}: ${error.message}`);
      });
      throw new ValidationError(data.errors);

    case 503:
      // RETRY: Throw retryable error
      throw new RetryableError(data.message);

    case 500:
      // ESCALATE: Log application_id for support
      console.error(`Contact Oscar support. Application ID: ${data.application_id}`);
      throw new InternalError(data.message);

    default:
      throw new Error(`Unexpected error: ${response.status}`);
  }
}

Support

If you encounter an ESCALATE error or need assistance:

  1. Collect the application_id from the error response
  2. Note the error_code and error message
  3. Contact Oscar support with this information

For questions about this API, contact the ICHRA team via Slack at #ichra-tech.


Changelog

DateChanges
2026-07-15Added QLE_HAS_NO_VALID_COVERAGE_DATES and ADDRESS_NOT_IN_SERVICE_AREA (rating-area case), both actionable, for errors that previously surfaced as INTERNAL_PROCESSING_ERROR.
2026-07-15Added INVALID_COVERAGE_START_DATE_FOR_QLE (actionable) for QLE coverage-start-date mismatches that previously surfaced as INTERNAL_PROCESSING_ERROR. Documented MISSING_QUALIFYING_EVENT.
2026-02-04Initial release of error handling documentation with error codes, categories, and retry strategies.

Did this page help you?