> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lexq.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors

> Complete error code reference for the LexQ platform — integration API and console. Codes are stable across versions; HTTP status and message text may evolve.

## Error Response Format

All errors follow the same envelope:

```json theme={null}
{
  "result": "ERROR",
  "code": "P-001",
  "message": "Policy group not found."
}
```

The `code` field is the stable identifier — pin your integration logic on this value, not on the human-readable `message`. Messages are localized via the `Accept-Language` header (`en` or `ko`) and may be reworded over time; codes are not.

<Info>
  This page enumerates every code the platform can return, across both the integration API and the console (account, billing, member management). Integration clients will never encounter some sections — Member & Account (M), or the sign-in entries under Auth, for example — but they are documented here so that any code you meet, on any surface, resolves to exactly one meaning.
</Info>

<Info>
  Code numbers are stable identifiers — once assigned, a code is never reused for a different meaning, even if the original meaning is removed. Gaps in numbering (e.g., missing `ACT-007`, `ACT-008`, `ACT-010`, `ACT-011`, `ACT-012`) reflect codes that were retired during the engine's domain-agnostic primitive refactor.
</Info>

## Common (C)

| Code    | HTTP | Description                            |
| ------- | :--: | -------------------------------------- |
| `C-001` |  400 | Invalid input value                    |
| `C-002` |  405 | HTTP method not allowed                |
| `C-003` |  404 | Requested resource not found           |
| `C-004` |  500 | Internal server error                  |
| `C-005` |  400 | Invalid data type                      |
| `C-006` |  409 | Duplicate resource                     |
| `C-007` |  429 | Too many requests (TPS limit exceeded) |
| `C-008` |  400 | Invalid timezone                       |
| `C-009` |  400 | Invalid status transition              |

## Auth (A)

| Code    | HTTP | Description                                    |
| ------- | :--: | ---------------------------------------------- |
| `A-001` |  401 | Authentication failed                          |
| `A-002` |  403 | Access denied                                  |
| `A-003` |  401 | Invalid API key                                |
| `A-004` |  409 | Email already registered                       |
| `A-005` |  409 | Maximum API keys exceeded                      |
| `A-006` |  401 | Invalid email or password                      |
| `A-007` |  409 | Phone number already registered                |
| `A-008` |  401 | Google Sign-In required for this account       |
| `A-009` |  401 | Google account email not verified              |
| `A-010` |  401 | Google authentication failed                   |
| `A-011` |  400 | Password reset unavailable for Google account  |
| `A-012` |  400 | Password change unavailable for Google account |
| `A-013` |  400 | New password must differ from current          |
| `A-014` |  400 | Password reset link expired or invalid         |
| `A-015` |  503 | Verification email send failed                 |
| `A-016` |  401 | Session expired                                |
| `A-017` |  401 | Invalid session                                |
| `A-018` |  403 | System account required                        |
| `A-019` |  403 | System Manager account is immutable            |
| `A-020` |  401 | Password incorrect                             |

## Policy Engine (P)

| Code    | HTTP | Description                                                                           |
| ------- | :--: | ------------------------------------------------------------------------------------- |
| `P-001` |  404 | Policy group not found                                                                |
| `P-002` |  404 | Policy version not found                                                              |
| `P-003` |  500 | Policy execution failed                                                               |
| `P-004` |  400 | Policy version not approved                                                           |
| `P-005` |  404 | Policy rule not found                                                                 |
| `P-006` |  400 | Cannot modify version (only DRAFT allowed)                                            |
| `P-007` |  400 | Cannot publish a version with no rules                                                |
| `P-008` |  400 | Operation not allowed in current status                                               |
| `P-009` |  403 | Policy group is disabled                                                              |
| `P-010` |  400 | Rule reorder ID mismatch                                                              |
| `P-011` |  400 | Activation Mode/Strategy mismatch within group                                        |
| `P-012` |  400 | Mutex Mode/Strategy mismatch within group                                             |
| `P-013` |  400 | No previous version available for rollback                                            |
| `P-014` |  404 | Deployment history not found                                                          |
| `P-015` |  400 | Required input facts missing from execution request                                   |
| `P-016` |  400 | Version does not belong to the target policy group                                    |
| `P-017` |  409 | Version is currently deployed or used in active A/B test                              |
| `P-018` |  400 | Effective period invalid (start after end)                                            |
| `P-019` |  400 | No deployed version exists for this group                                             |
| `P-020` |  409 | Cannot delete group with live deployment                                              |
| `P-021` |  409 | Cannot delete group with active A/B test                                              |
| `P-022` |  400 | Condition field required for SINGLE conditions                                        |
| `P-023` |  400 | Condition operator required for SINGLE conditions                                     |
| `P-024` |  400 | Condition tree exceeds maximum depth                                                  |
| `P-025` |  400 | Duplicate rule priority within policy version                                         |
| `P-026` |  400 | Duplicate group priority within activation group cluster                              |
| `P-027` |  400 | Condition operator/value type mismatch                                                |
| `P-028` |  400 | Condition `valueType` required (no silent inference)                                  |
| `P-029` |  400 | Condition `value` required (null semantics unsupported)                               |
| `P-030` |  404 | Domain template not found                                                             |
| `P-031` |  400 | Domain template not yet available                                                     |
| `P-032` |  409 | Policy group name already in use                                                      |
| `P-033` |  409 | Auto-resolution of unique group name failed                                           |
| `P-034` |  400 | Group reorder ID mismatch (missing or archived)                                       |
| `P-035` |  400 | Profile time range invalid (`from` must be earlier than `to`)                         |
| `P-036` |  400 | Version is already live (nothing to deploy)                                           |
| `P-037` |  400 | Version's effective start date has not arrived — use Scheduled Deployment             |
| `P-038` |  409 | A pending scheduled deployment already exists for this group                          |
| `P-039` |  404 | No pending scheduled deployment to cancel                                             |
| `P-040` |  400 | Version is not eligible for scheduling (must be ACTIVE with a future effective start) |
| `P-041` |  400 | Scheduled time is already in the past — deploy immediately instead                    |
| `P-042` |  400 | A/B variant version is not currently servable                                         |
| `P-043` |  409 | A pending scheduled deployment references this version — cancel it before deleting    |

## Idempotency (I)

| Code    | HTTP | Description                                           |
| ------- | :--: | ----------------------------------------------------- |
| `I-001` |  409 | Request already processed (duplicate idempotency key) |
| `I-002` |  409 | Request currently being processed                     |

## System / Crypto (S)

| Code    | HTTP | Description       |
| ------- | :--: | ----------------- |
| `S-001` |  500 | Encryption failed |
| `S-002` |  500 | Decryption failed |

## Billing (B)

| Code    | HTTP | Description                                              |
| ------- | :--: | -------------------------------------------------------- |
| `B-001` |  404 | Plan not found                                           |
| `B-002` |  404 | Subscription not found                                   |
| `B-003` |  409 | Active subscription already exists                       |
| `B-004` |  400 | Invalid subscription status                              |
| `B-005` |  404 | Invoice not found                                        |
| `B-006` |  500 | No payment processor for the requested currency          |
| `B-007` |  502 | Payment processing failed                                |
| `B-008` |  403 | Service quota exceeded                                   |
| `B-009` |  400 | Free plan cannot be canceled                             |
| `B-010` |  400 | Payment method required before paid subscription         |
| `B-011` |  400 | Billing profile required before paid subscription        |
| `B-012` |  400 | Invoice already paid                                     |
| `B-013` |  400 | Already subscribed to this plan                          |
| `B-014` |  400 | Cross-currency plan change not supported                 |
| `B-015` |  400 | Cannot downgrade directly to Free plan — cancel first    |
| `B-016` |  409 | Cannot delete plan currently in use                      |
| `B-017` |  400 | Currency immutable while subscribed to paid plan         |
| `B-018` |  400 | No scheduled downgrade to cancel                         |
| `B-019` |  409 | A public plan with this tier and currency already exists |
| `B-020` |  400 | Invalid currency code                                    |
| `B-021` |  400 | Payment setup reference invalid or expired               |
| `B-022` |  400 | Webhook signature verification failed                    |

## Member & Account (M)

| Code    | HTTP | Description                                            |
| ------- | :--: | ------------------------------------------------------ |
| `M-001` |  404 | Member not found                                       |
| `M-002` |  403 | Email verification required                            |
| `M-003` |  403 | Account suspended                                      |
| `M-004` |  403 | Account withdrawn                                      |
| `M-005` |  400 | Invalid or expired verification code                   |
| `M-006` |  400 | Member already active                                  |
| `M-007` |  400 | Invitation expired                                     |
| `M-008` |  400 | Invalid invitation token                               |
| `M-009` |  400 | Cannot perform this action on yourself                 |
| `M-010` |  400 | Cannot remove or demote the last admin                 |
| `M-011` |  409 | Phone number already registered                        |
| `M-012` |  403 | Account suspended (with reason)                        |
| `M-013` |  400 | Admin role cannot be assigned via invitation           |
| `M-014` |  409 | Previous subscription still finalizing — retry shortly |

## Analytics & Simulation (AN)

| Code     | HTTP | Description                                         |
| -------- | :--: | --------------------------------------------------- |
| `AN-001` |  500 | Simulation processing failed                        |
| `AN-002` |  404 | Dataset not found                                   |
| `AN-003` |  400 | Dataset too large                                   |
| `AN-004` |  400 | Dataset contains no records                         |
| `AN-005` |  400 | Invalid dataset format                              |
| `AN-006` |  400 | Unsupported dataset source                          |
| `AN-007` |  500 | Dataset storage error                               |
| `AN-008` |  400 | Invalid baseline version                            |
| `AN-009` |  404 | Simulation not found                                |
| `AN-010` |  400 | Only PENDING or RUNNING simulations can be canceled |
| `AN-011` |  400 | Only completed simulations can be exported          |
| `AN-012` |  500 | Simulation export failed                            |
| `AN-013` |  404 | Uploaded dataset file not found                     |
| `AN-014` |  400 | Dataset file parse failed                           |
| `AN-015` |  500 | Simulation result data malformed                    |
| `AN-016` |  400 | Required fact missing in dataset                    |
| `AN-017` |  400 | Fact type mismatch in dataset                       |
| `AN-018` |  400 | Date range required for HISTORICAL datasets         |
| `AN-019` |  400 | File path required for UPLOADED datasets            |
| `AN-020` |  400 | Selected dataset file is empty                      |
| `AN-021` |  400 | Dataset file exceeds size limit                     |
| `AN-022` |  400 | Unsupported dataset file type                       |
| `AN-023` |  400 | Unsupported export format                           |
| `AN-024` |  404 | Replay target execution not found                   |
| `AN-025` |  404 | Replay job not found                                |
| `AN-026` |  404 | Decision trace not found                            |
| `AN-027` |  400 | Requested fact is not marked as PII                 |
| `AN-028` |  409 | Version has an audit trail and cannot be deleted    |
| `AN-029` |  500 | Audit sealing failed — the operation was rejected   |

## Action & Calculation (ACT)

| Code      | HTTP | Description                                                  |
| --------- | :--: | ------------------------------------------------------------ |
| `ACT-001` |  400 | Action parameters are empty                                  |
| `ACT-002` |  400 | Reference variable `refVar` is required                      |
| `ACT-003` |  400 | Invalid calculation method (allowed: PERCENTAGE, AMOUNT)     |
| `ACT-004` |  400 | Rate parameter required for PERCENTAGE method                |
| `ACT-005` |  400 | Value parameter required for AMOUNT method                   |
| `ACT-006` |  400 | Invalid action type                                          |
| `ACT-009` |  400 | Integration ID required for external service action          |
| `ACT-013` |  400 | Webhook URL or integration reference required                |
| `ACT-014` |  400 | Fact key required for SET\_FACT action                       |
| `ACT-015` |  400 | Tag value required for ADD\_TAG action                       |
| `ACT-016` |  400 | `targetVar` required for INCREMENT\_FACT action              |
| `ACT-017` |  400 | Rounding option must be an object                            |
| `ACT-018` |  400 | Rounding scale must be an integer                            |
| `ACT-019` |  400 | Rounding scale out of range `[0, 16]`                        |
| `ACT-020` |  400 | Invalid rounding mode                                        |
| `ACT-021` |  400 | Operator required for MUTATE\_FACT action                    |
| `ACT-022` |  400 | Invalid operator                                             |
| `ACT-023` |  400 | Invalid operator-method combination (e.g., DIV + PERCENTAGE) |
| `ACT-024` |  400 | Division by zero not allowed                                 |
| `ACT-025` |  400 | `refVar` not found in input facts                            |
| `ACT-026` |  400 | `targetVar` not found in input facts                         |
| `ACT-027` |  400 | EMIT\_EVENT requires non-empty `eventPayload`                |
| `ACT-028` |  400 | EMIT\_NOTIFICATION requires non-empty `notificationPayload`  |

<Info>
  Codes `ACT-007`, `ACT-008`, `ACT-010`, `ACT-011`, `ACT-012` were retired when the engine moved to domain-agnostic action primitives. Their numbers are not reused.
</Info>

## Fact Definition (FD)

| Code     | HTTP | Description                               |
| -------- | :--: | ----------------------------------------- |
| `FD-001` |  409 | Fact key already exists                   |
| `FD-002` |  404 | Fact not found                            |
| `FD-003` |  403 | System fact cannot be modified or deleted |
| `FD-004` |  400 | Invalid fact key format                   |
| `FD-005` |  400 | Fact key reserved for system use          |

## Integration (INT)

| Code      | HTTP | Description                               |
| --------- | :--: | ----------------------------------------- |
| `INT-001` |  404 | Integration not found                     |
| `INT-002` |  409 | Integration name already exists           |
| `INT-003` |  400 | Invalid integration configuration         |
| `INT-004` |  400 | Integration type cannot be changed        |
| `INT-005` |  400 | Integration config missing required field |
| `INT-006` |  400 | Invalid HTTP method for integration       |
| `INT-007` |  400 | Required integration config field missing |

## Failure Log (FL)

| Code     | HTTP | Description                                     |
| -------- | :--: | ----------------------------------------------- |
| `FL-001` |  404 | Failure log not found                           |
| `FL-002` |  400 | Action invalid for failure log in current state |
| `FL-003` |  400 | Retry not supported for this task type          |

## Webhook Subscription (WH)

| Code     | HTTP | Description                                                |
| -------- | :--: | ---------------------------------------------------------- |
| `WH-001` |  404 | Webhook subscription not found                             |
| `WH-002` |  409 | Webhook subscription name already exists                   |
| `WH-003` |  502 | Webhook test delivery failed                               |
| `WH-004` |  400 | Invalid webhook URL (http/https only)                      |
| `WH-005` |  400 | Webhook URL blocked — resolves to private/internal address |
