> For the complete documentation index, see [llms.txt](https://host2host.onibonje.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://host2host.onibonje.com/docs/31-error-code-catalog.md).

# Error and Reason Code Catalog

## 1. Overview

Standardized error codes flow through validation → Finacle → ACK/NACK → partner portal → audit. **Module:** `h2h-common` (`com.heirs.h2h.common.error`).

Every rejection includes: `errorCode`, `errorMessage`, `correlationId`, `severity`, `retryable`.

***

## 2. Code Structure

```
{DOMAIN}_{NNN}

DOMAIN: VAL | FIN | FILE | SEC | SYS | RECON | IDEM
NNN:    001-999 sequential per domain
```

***

## 3. Validation Errors (VAL)

| Code      | Message                         | Retryable | ACK line          |
| --------- | ------------------------------- | --------- | ----------------- |
| `VAL_001` | Required field missing          | No        | NACK              |
| `VAL_002` | Invalid account format          | No        | NACK              |
| `VAL_003` | Amount must be positive         | No        | NACK              |
| `VAL_004` | Currency mismatch               | No        | NACK              |
| `VAL_005` | RegEx validation failed         | No        | NACK              |
| `VAL_006` | Daily limit exceeded            | No        | NACK              |
| `VAL_007` | Per-transaction limit exceeded  | No        | NACK              |
| `VAL_008` | Invalid date / past value date  | No        | NACK              |
| `VAL_009` | Custom script validation failed | No        | NACK              |
| `VAL_010` | Schema validation failed        | No        | NACK (file-level) |

Configurable via `validation_rule.error_code` in DB.

***

## 4. Finacle Errors (FIN)

| Code      | Message                  | Retryable | Maps from             |
| --------- | ------------------------ | --------- | --------------------- |
| `FIN_001` | Insufficient funds       | No        | Finacle balance check |
| `FIN_002` | Invalid account          | No        | Account not found     |
| `FIN_003` | Duplicate reference      | No        | Idempotent replay     |
| `FIN_004` | Limit exceeded           | No        | Core banking limit    |
| `FIN_005` | Cut-off time exceeded    | No        | Calendar              |
| `FIN_006` | Account frozen           | No        | Status check          |
| `FIN_007` | Invalid beneficiary bank | No        | Routing               |
| `FIN_010` | Finacle timeout          | Yes       | Socket timeout        |
| `FIN_011` | Finacle unavailable      | Yes       | Circuit breaker       |
| `FIN_012` | Finacle internal error   | Yes       | Unknown 5xx           |

See [Finacle Integration](/docs/23-finacle-integration.md) §8.

***

## 5. File Errors (FILE)

| Code       | Message                 | Retryable |
| ---------- | ----------------------- | --------- |
| `FILE_001` | Checksum mismatch       | No        |
| `FILE_002` | PGP decrypt failed      | No        |
| `FILE_003` | Unsupported file format | No        |
| `FILE_004` | Empty file              | No        |
| `FILE_005` | File too large          | No        |
| `FILE_006` | Duplicate file          | No        |
| `FILE_007` | Delivery failed         | Yes       |
| `FILE_008` | Signed URL expired      | No        |

***

## 6. Security Errors (SEC)

| Code      | Message                 | Retryable |
| --------- | ----------------------- | --------- |
| `SEC_001` | Authentication failed   | No        |
| `SEC_002` | HMAC signature invalid  | No        |
| `SEC_003` | Request replay detected | No        |
| `SEC_004` | Certificate expired     | No        |
| `SEC_005` | IP not allowlisted      | No        |
| `SEC_006` | PGP signature invalid   | No        |

***

## 7. System Errors (SYS)

| Code      | Message                   | Retryable |
| --------- | ------------------------- | --------- |
| `SYS_001` | Internal processing error | Yes       |
| `SYS_002` | Config not found          | No        |
| `SYS_003` | Transform failed          | No        |
| `SYS_004` | Script execution failed   | No        |
| `SYS_005` | Kafka publish failed      | Yes       |
| `SYS_006` | Database unavailable      | Yes       |

***

## 8. Idempotency (IDEM)

| Code       | Message               | Action                            |
| ---------- | --------------------- | --------------------------------- |
| `IDEM_001` | Duplicate transaction | Skip post, return original result |
| `IDEM_002` | Duplicate file        | Skip processing, audit only       |

***

## 9. Reconciliation (RECON)

| Code        | Message                   |
| ----------- | ------------------------- |
| `RECON_001` | No match found            |
| `RECON_002` | Amount tolerance exceeded |
| `RECON_003` | Date window exceeded      |
| `RECON_004` | Manual match required     |

See [Reconciliation](/docs/26-reconciliation.md).

***

## 10. ACK/NACK Mapping

| Batch outcome | File-level code       | Line-level                |
| ------------- | --------------------- | ------------------------- |
| Full success  | —                     | All `SUCCESS`             |
| Partial       | `VAL_010` optional    | Mix SUCCESS + error codes |
| Full reject   | `VAL_010` or `FILE_*` | All lines NACK            |

ACK format carries: `instructionId`, `customerReference`, `status`, `errorCode`, `bankReference`.

See [ACK/NACK Framework](/docs/25-ack-nack-framework.md).

***

## 11. HTTP API Mapping

| HTTP Status | When                              |
| ----------- | --------------------------------- |
| 400         | VAL\_\* validation                |
| 401         | SEC\_001, SEC\_002                |
| 409         | IDEM\_001                         |
| 422         | FIN\_001–FIN\_007 business reject |
| 500         | SYS\_\*, FIN\_010–FIN\_012        |
| 503         | FIN\_011 circuit open             |

***

## 12. Observability

All errors emit:

* Structured log with `errorCode`
* Metric `h2h_errors_total{code, partner, route}`
* Audit event with code (no PII in message field)

***

## 13. Extensibility

New codes added via:

1. `h2h-common` enum (L4 — requires JAR for new domain)
2. `custom_error_def` table (L2 — partner-specific validation messages)

***

## 14. Related Documents

* [23 Finacle Integration](/docs/23-finacle-integration.md)
* [25 ACK/NACK Framework](/docs/25-ack-nack-framework.md)
* [29 Canonical Data Model](/docs/29-canonical-data-model.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://host2host.onibonje.com/docs/31-error-code-catalog.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
