Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
fix(api): make the 23503 message direction-neutral
Raul87c9a2969f31
diff --git a/apps/erp/app/routes/api+/v1+/lib/database-errors.ts b/apps/erp/app/routes/api+/v1+/lib/database-errors.tsindex 5b36ef3ed3..9a01b120d8 100644--- a/apps/erp/app/routes/api+/v1+/lib/database-errors.ts+++ b/apps/erp/app/routes/api+/v1+/lib/database-errors.ts@@ -29,7 +29,12 @@ export type DatabaseFailureKind =*/export const DATABASE_ERROR_MESSAGES: Record<DatabaseFailureKind, string> = {conflict: "Database error: a record with these values already exists.",- reference: "Database error: a referenced record does not exist.",+ // Direction-neutral on purpose: 23503 fires both when a row references a+ // missing parent AND when a delete or update is blocked because dependent rows+ // still reference the target. Naming only the first sends the caller to the+ // wrong correction on the second.+ reference:+ "Database error: the operation would violate a reference between records.",required: "Database error: a required field was missing.",permission:"Database error: this credential is not permitted to perform that operation.",