EXTERNAL_REF_EXISTS
A record of this resource already carries the external_ref you sent. existing_id is that record's id.
Typical cause
The same create was sent again: a migration batch run a second time, or a retry of a request whose first answer was lost. Every record can carry your own id in external_ref, unique per organization and resource, so the second create is refused.
Fix
Adopt existing_id, or send on_conflict: "return" (answer the existing record) or "update" (upsert) beside data.
Where it comes from
These 39 operations name it:
- POSTCreate a fiscal yearcreateFiscalYear
- POSTCreate an accountcreateAccount
- PATCHUpdate an accountupdateAccount
- POSTCreate a dimensioncreateDimension
- POSTCreate a dimension valuecreateDimensionValue
- PATCHUpdate a dimension valueupdateDimensionValue
- PATCHUpdate a dimensionupdateDimension
- POSTCreate a contactcreateContact
- PATCHUpdate a contactupdateContact
- POSTCreate an itemcreateItem
- PATCHUpdate an itemupdateItem
- POSTCreate a transactioncreateTransaction
- POSTCreate a meter readingcreateMeterReading
- PATCHUpdate a meter readingupdateMeterReading
- POSTCreate a meter typecreateMeterType
- PATCHUpdate a meter typeupdateMeterType
- POSTCreate a metercreateMeter
- PATCHUpdate a meterupdateMeter
- POSTCreate an object typecreateObjectType
- PATCHUpdate an object typeupdateObjectType
- POSTCreate an objectcreateObject
- PATCHUpdate an objectupdateObject
- POSTCreate a quotecreateQuote
- PATCHUpdate a quoteupdateQuote
- POSTCreate a sales invoicecreateSalesInvoice
- PATCHUpdate a sales invoiceupdateSalesInvoice
- POSTCreate a billing plancreateBillingPlan
- PATCHUpdate a billing planupdateBillingPlan
- POSTCreate a billing runcreateBillingRun
- POSTCreate a purchase invoicecreatePurchaseInvoice
- PATCHUpdate a purchase invoiceupdatePurchaseInvoice
- POSTCreate a paymentcreatePayment
- POSTCreate a bank accountcreateBankAccount
- PATCHUpdate a bank accountupdateBankAccount
- POSTCreate a documentcreateDocument
- POSTCreate a fixed-asset groupcreateFixedAssetGroup
- PATCHUpdate a fixed-asset groupupdateFixedAssetGroup
- POSTCreate a fixed assetcreateFixedAsset
- PUTReplace the opening statereplaceOpeningState
Related
{
"error": {
"code": "EXTERNAL_REF_EXISTS",
"message": "…",
"existing_id": "0b8f0c2e-5f3c-4a52-9d7e-1c2b3a4d5e6f",
"request_id": "req_01JB4Z0K3Q7V8W9X0Y1Z2A3B4C",
"doc_url": "https://developers.tracken.ee/errors/EXTERNAL_REF_EXISTS"
}
}code, never on message, which is developer-facing English and may change. Field problems are in details, each with a JSON Pointer; the figures for your own text are in context. Quote request_id when you contact support.tracken fiscal-years create …
# exits 7 and prints the code, the message, each field problem and the request idimport { isApiError } from "@tracken/sdk";
try {
await tracken.fiscalYears.create(…);
} catch (error) {
if (!isApiError(error, "EXTERNAL_REF_EXISTS")) throw error;
// Adopt existing_id, or send on_conflict: "return" (answer the existing record) or "update" (upsert) beside data.
}