Planifica API Error Codes
Error Codes
The full error-code catalog for the optimizer and the partner API gateway, split out from the main reference so it stays easy to scan.
Optimizer Error Codes
Domain-level scheduling errors returned inside the response body by the optimize, allocation, and validate endpoints — not as HTTP error statuses.
Request Data Integrity
DUPLICATE_SESSION_IDData IntegrityThe same session id is used by more than one session in the request. Session IDs must be unique.
PARENT_ID_DURATION_CONFLICTData IntegrityTwo or more sessions share the same parentId but have different duration values. All sessions in a group must have the same length.
SESSION_INSTRUCTOR_CONFLICTData IntegrityTwo locked sessions are pinned to overlapping times and would require the same instructor at once.
NO_VALID_SESSIONSData IntegrityAfter processing the request, no sessions remained to schedule — check your schemas/sessions data.
INVALID_WORKING_DAYData IntegritySomething in the request (an instructor's available_days, a grade's working_hours, or a capacity/affinity/cardinality config day) references a day that isn't one of the school's configured working_days.
Setup & Prerequisites
NO_CLASSROOMSSetupThe request contains no classrooms at all. At least one is required.
NO_INSTRUCTORSSetupThe request contains no instructors at all. At least one is required.
SUBJECT_NO_INSTRUCTORSSetupA subject is used by one or more sessions, but no instructor lists that subject as something they can teach.
INSTRUCTOR_NO_GRADESWarning onlyAn instructor isn't assigned to any grade, so they can never be matched to a session.
NO_AVAILABLE_ROOMSWarning onlyA session has no classroom that matches its subject's room requirements. The session can still be scheduled without a fixed room, but you should add a suitable classroom.
Availability & Feasibility
NO_AVAILABLE_INSTRUCTORSAvailabilityA session's grade/subject combination has zero instructors that can teach it (after matching availability and grade assignment).
NO_AVAILABLE_TIMESLOTSAvailabilityA session has matching instructors, but no time slot fits its duration alongside grade hours and other constraints.
UNSCHEDULABLE_SESSIONAvailabilityCatch-all: a session cannot be placed anywhere that satisfies all of its requirements simultaneously (instructor, room, time, ordering, etc.).
INSUFFICIENT_CONTINUOUS_SLOTSAvailabilityA grade has a session whose duration exceeds the longest continuous block of available time in that grade's working hours. Lengthening or rearranging working hours is required.
SPECIALIZED_ROOM_CAPACITY_EXCEEDEDAvailabilityThe total hours of sessions that require a specific specialized room exceed the total time slots available for that room across the whole week.
Instructor & Grade Capacity
INSTRUCTOR_OVERALLOCATIONCapacityA locked session assigns more hours to an instructor than they have available — either overall, or specifically within one grade.
INSUFFICIENT_INSTRUCTOR_CAPACITYCapacityThe hours required for a (grade, subject) pair exceed the combined available capacity of instructors who can teach it.
INSUFFICIENT_TOTAL_INSTRUCTOR_CAPACITYCapacityThe hours required for a subject, summed across all grades, exceed the total capacity of every instructor who can teach it.
INSUFFICIENT_GRADE_CAPACITYCapacityA grade/group's total scheduled hours exceed the maximum hours available in that grade's school week.
INSUFFICIENT_TOTAL_CAPACITYWarning onlyThe total teaching time needed across the whole request exceeds what all instructors combined can provide.
Locked Sessions (Incremental Optimization)
A session becomes "locked" once both day and start are set — see Understanding Constraints on the API concepts page.
LOCKED_SESSION_INSTRUCTOR_UNAVAILABLELocked SessionA locked session (with day, start, and institutor all set) falls outside that instructor's declared availability.
LOCKED_SESSION_OUTSIDE_GRADE_HOURSLocked SessionA locked session's start time — or its full duration — falls outside the grade's configured working_hours.
FIXED_SESSION_CLASS_CONFLICTLocked SessionTwo locked sessions belonging to the same grade/group can't both be scheduled without overlapping — their fixed times are mutually incompatible.
FIXED_SESSION_ROOM_CONFLICTLocked SessionTwo or more locked sessions require the same specialized classroom at the same time slot.
CAPACITY_WINDOW_INFEASIBLELocked SessionA combination of locked sessions and capacity/cardinality config windows can't be satisfied — e.g. sessions locked into a time window exceed that window's hour or count limit.
Session Ordering & Spacing
These relate to ordering_configs rules — see Understanding Constraints on the API concepts page.
SESSION_ORDERING_CYCLEOrderingThe follows constraints for a grade form a circular dependency (A follows B, B follows A, directly or transitively). Remove or rework one of the constraints.
INVALID_DISTANCE_BETWEEN_CONFIGOrderingA distance_between entry is malformed — missing both gap bounds, a negative gap, min_gap_slots > max_gap_slots, or its subject/session targets don't resolve to any session. (A small subset of these same checks are instead caught earlier as 422 schema errors.)
DISTANCE_BETWEEN_INFEASIBLEOrderingA distance_between constraint can't be satisfied given the other constraints in the request — e.g. no placement keeps the required minimum/maximum gap between the referenced sessions.
Cardinality Configuration
INVALID_CARDINALITY_CONFIGCardinalityA cardinality_configs entry is malformed. Covers many distinct sub-cases: missing/invalid subject, cardinality <= 0, missing/invalid day or time window fields, a window that doesn't align to any timetable slot, or a duplicate window for the same subject. The message field always spells out which sub-case applies.
Reserved — Not Currently Emitted
These codes exist in the API's ErrorCodeenum for forward compatibility but aren't currently produced by any endpoint. You may see them in generated client SDKs or OpenAPI schemas — there's no need to handle them today, and their absence from a response is expected, not a sign your integration is missing something.
NO_AVAILABLE_CAPACITYEXCESSIVE_INSTRUCTOR_CAPACITYINSTRUCTOR_TIME_CONFLICTROOM_TIME_CONFLICTGRADE_GROUP_TIME_CONFLICTCARDINALITY_FEASIBILITY_WARNINGError Response Example
{
"id": "validation_123",
"valid": false,
"errors": [
{
"message": "Session scheduled outside valid working days",
"code": "INVALID_WORKING_DAY",
"grade": "CP",
"group": "A",
"subject": "MATH"
},
{
"message": "No instructors are available for the session",
"code": "NO_AVAILABLE_INSTRUCTORS",
"grade": "CM1",
"subject": "SCIENCE"
}
],
"warnings": []
}Partner API Error Codes
Auth and HTTP-level errors specific to the partner gateway (API key issues, rate limiting, request validation).
code: SCHOOL_REQUIREDmessage: API key requiredmessage: Invalid API key formatmessage: Invalid API keymessage: API key is disabledmessage: API key has expiredmessage: Rate limit exceededmessage: IP address not whitelistedmessage: Origin not allowedmessage: Endpoint not allowedmessage: API key is not scoped to application 'planifica'message: Service account has no permission for applicationcode: ML_UNREACHABLEcode: ML_TIMEOUTcode: ML_ERROR_400code: ML_ERROR_401 or ML_ERROR_403code: ML_ERROR_404code: ML_ERROR_429code: ML_ERROR_500, ML_ERROR_502, or ML_ERROR_503code: UNKNOWN_ERRORmessage: Task {taskId} not foundmessage: Task {taskId} is already completed or failedmessage: Failed to get task status