Skip to main content

Error Codes

Intellicon CRM uses structured error codes in the format ICN-XXXX. Error codes are grouped by category using numeric ranges.

Error Response Format

All API errors follow this structure:

{
"statusCode": 400,
"message": "Lead with this email already exists",
"errorCode": "ICN-1201",
"error": "Bad Request",
"details": ["A lead with email alice@startup.io exists in stage 'Qualified'"]
}

ICN-1000 -- ICN-1099: Authentication Errors

CodeHTTPDescription
ICN-1000401Invalid credentials (wrong email or password)
ICN-1001401Account is deactivated
ICN-1002401Access token expired
ICN-1003401Invalid access token signature
ICN-1004401Refresh token expired
ICN-1005401Invalid refresh token
ICN-1006401Missing Authorization header
ICN-1010400Password does not meet requirements
ICN-1011400Invalid registration data
ICN-1012409Email already registered
ICN-1013409Company name already taken
ICN-1014404Tenant not found (invalid slug)
ICN-1020400Invitation token expired
ICN-1021400Invitation token already used
ICN-1022404Invitation token not found
ICN-1030400Password reset token expired
ICN-1031404Password reset token not found
ICN-1032400Current password is incorrect (change-password)

ICN-1100 -- ICN-1199: User & Role Errors

CodeHTTPDescription
ICN-1100404User not found
ICN-1101409User with this email already exists
ICN-1102403Insufficient permissions for this action
ICN-1103403Cannot deactivate your own account
ICN-1104403Cannot delete your own account
ICN-1105400Cannot assign a higher role than your own
ICN-1110404Role not found
ICN-1111409Role name already exists
ICN-1112400Cannot delete role with assigned users
ICN-1113400Cannot delete the default admin role
ICN-1120404Department not found
ICN-1121409Department name already exists
ICN-1130404Team not found
ICN-1131409Team name already exists

ICN-1200 -- ICN-1299: Lead Errors

CodeHTTPDescription
ICN-1200404Lead not found
ICN-1201409Duplicate lead detected (matching email/phone)
ICN-1202400Invalid lead data
ICN-1203400Required stage fields not provided
ICN-1204400Cannot transition to this stage
ICN-1205400Lead already converted
ICN-1206400Lead already disqualified
ICN-1207400Conversion prerequisites not met
ICN-1210404Pipeline not found
ICN-1211404Stage not found
ICN-1212400Stage does not belong to this pipeline
ICN-1220400SLA policy violation
ICN-1221404Scoring rule not found
ICN-1230400Import file format not supported
ICN-1231400Import column mapping invalid
ICN-1232404Import job not found

ICN-1300 -- ICN-1399: Opportunity Errors

CodeHTTPDescription
ICN-1300404Opportunity not found
ICN-1301409Duplicate opportunity detected
ICN-1302400Invalid opportunity data
ICN-1303400Required stage fields not provided
ICN-1304400Opportunity is already closed
ICN-1305400Cannot reopen — reason required
ICN-1310404Contact role not found
ICN-1311409Contact already associated with this opportunity
ICN-1320404Line item not found
ICN-1321400Invalid line item data
ICN-1330404Close reason not found
ICN-1331404Priority not found

ICN-1400 -- ICN-1499: Deal Errors

CodeHTTPDescription
ICN-1400404Deal not found
ICN-1401400Invalid deal data
ICN-1402400Deal status transition not allowed
ICN-1410404Contract not found
ICN-1420404Invoice not found
ICN-1421400Invoice already paid
note

Deal error codes (ICN-1400 series) are reserved for Sprint 5 (Deals Module).

ICN-1500 -- ICN-1599: Project Errors

CodeHTTPDescription
ICN-1500404Project not found
ICN-1501400Invalid project data
ICN-1502400Project phase transition not allowed
ICN-1510404Phase not found
ICN-1520400Task dependency cycle detected
note

Project error codes (ICN-1500 series) are reserved for Sprint 8 (Projects Module).

ICN-1600 -- ICN-1699: Support Errors

CodeHTTPDescription
ICN-1600404Ticket not found
ICN-1601400Invalid ticket data
ICN-1602400Ticket status transition not allowed
ICN-1610404SLA policy not found
note

Support error codes (ICN-1600 series) are reserved for Sprint 10 (Support Tickets).

ICN-9000 -- ICN-9099: Generic / Validation Errors

CodeHTTPDescription
ICN-9000400Generic validation error
ICN-9001400Required field missing
ICN-9002400Invalid field format
ICN-9003400Value out of allowed range
ICN-9004400Invalid UUID format
ICN-9005400Invalid date format
ICN-9010413File too large
ICN-9011400Unsupported file type
ICN-9020403Admin access required
ICN-9021403Insufficient module permissions
ICN-9022403Record access denied
ICN-9023403Field is read-only
ICN-9030500Internal server error
ICN-9031503Database connection error
ICN-9032503Redis connection error
ICN-9033503Email service unavailable

Handling Errors in the Frontend

Centralized Error Handler

import { AxiosError } from 'axios';

interface ApiError {
statusCode: number;
message: string;
errorCode?: string;
details?: string[];
}

export function handleApiError(error: AxiosError<ApiError>) {
const data = error.response?.data;

if (!data) {
return 'Network error. Please check your connection.';
}

// Handle specific error codes
switch (data.errorCode) {
case 'ICN-1002':
// Token expired — should be handled by interceptor
return 'Session expired. Please log in again.';

case 'ICN-1201':
return 'A lead with this email already exists.';

case 'ICN-1203':
return `Please fill in the required fields: ${data.details?.join(', ')}`;

case 'ICN-9021':
return 'You do not have permission to perform this action.';

default:
return data.message || 'An unexpected error occurred.';
}
}

Using in Components

try {
await leadsApi.create(formData);
toast.success('Lead created successfully');
} catch (err) {
const message = handleApiError(err as AxiosError<ApiError>);
toast.error(message);
}

Custom Error Responses

Backend services throw typed exceptions that NestJS converts to standard error responses:

import { BadRequestException, NotFoundException, ConflictException, ForbiddenException } from '@nestjs/common';

// 400 Bad Request
throw new BadRequestException({
message: 'Required stage fields not provided',
errorCode: 'ICN-1203',
details: ['amount is required', 'close_date is required'],
});

// 404 Not Found
throw new NotFoundException({
message: 'Lead not found',
errorCode: 'ICN-1200',
});

// 409 Conflict
throw new ConflictException({
message: 'Duplicate lead detected',
errorCode: 'ICN-1201',
details: ['A lead with email alice@startup.io exists in stage "Qualified"'],
});

// 403 Forbidden
throw new ForbiddenException({
message: 'Insufficient permissions',
errorCode: 'ICN-9021',
});