# createAccount

## Overview

Adds a GL account to a company's chart of accounts. The bundled chart of accounts is otherwise seed-only — there is no other way to add an account to a running workspace — so this resolver lets an operator add a missing account (for example a Cash / Bank Deposits **ASSET** account for outgoing payments to credit) without a destructive re-seed. The native coa-management command validates that the owning company exists and is active, requires a non-empty `name` and a well-formed `code`, and rejects a `code` that already exists in the company. `accountType` must be one of ASSET / LIABILITY / EQUITY / REVENUE / EXPENSE (validated in the resolver before the command runs). The account is created ACTIVE.

## Modules Commands Used

- [coa-management] createAccount

## Exception Handling

| Error Code | Description |
| --- | --- |
| N/A (validation) | Thrown for an `accountType` outside ASSET / LIABILITY / EQUITY / REVENUE / EXPENSE |
| COA_MANAGEMENT_COMPANY_NOT_FOUND | The owning company does not exist. |
| COA_MANAGEMENT_COMPANY_INACTIVE | The owning company is not active. |
| COA_MANAGEMENT_DUPLICATE_ACCOUNT_CODE | An account with the same code already exists in the company. |
| COA_MANAGEMENT_NAME_REQUIRED | The account name is empty. |
| COA_MANAGEMENT_INVALID_ACCOUNT_CODE | The account code is not well-formed. |
