Wildberries API TypeScript SDK / MetadataValidationError
Class: MetadataValidationError
Defined in: errors/in-store-pickup-errors.ts:246
Error thrown when product metadata validation fails
HTTP Status: 409 Conflict (metadata update failures) Retry: No (permanent failure - requires correct data or order state) Rate Limit: 409 responses count as 10 requests!
This error occurs when attempting to set metadata (SGTIN, UIN, IMEI, GTIN) codes but the operation fails due to:
- Invalid code format
- Order not in
confirmstatus - Metadata type not in order's
requiredMetalist - Delivery not by WB (for UIN, IMEI, GTIN)
Example
try {
await sdk.inStorePickup.setSGTINCode(12345, ['invalid-code']);
} catch (error) {
if (error instanceof MetadataValidationError) {
console.error(`Cannot set ${error.codeType}:`, error.getUserMessage());
// Check order status
const statuses = await sdk.inStorePickup.getOrderStatuses([12345]);
console.log('Current status:', statuses.orders[0].supplierStatus);
// Check required metadata
const newOrders = await sdk.inStorePickup.getNewOrders();
const order = newOrders.orders.find(o => o.id === 12345);
console.log('Required metadata:', order?.requiredMeta);
}
}Extends
Constructors
Constructor
new MetadataValidationError(
codeType: "SGTIN" | "UIN" | "IMEI" | "GTIN",
orderId: number,
message: string,
requestId?: string): MetadataValidationError;Defined in: errors/in-store-pickup-errors.ts:255
Creates a new MetadataValidationError
Parameters
| Parameter | Type | Description |
|---|---|---|
codeType | "SGTIN" | "UIN" | "IMEI" | "GTIN" | Type of metadata code (SGTIN, UIN, IMEI, GTIN) |
orderId | number | ID of the order for which metadata update failed |
message | string | Detailed error message from API |
requestId? | string | Optional request ID from API response |
Returns
MetadataValidationError
Overrides
Properties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
<a id="statuscode"></a> statusCode? | readonly | number | HTTP status code if applicable | WBAPIError.statusCode | errors/base-error.ts:25 |
<a id="response"></a> response? | readonly | unknown | API response body if available | WBAPIError.response | errors/base-error.ts:30 |
<a id="requestid"></a> requestId? | readonly | string | Correlation ID for debugging and tracing requests | WBAPIError.requestId | errors/base-error.ts:35 |
<a id="origin"></a> origin? | readonly | string | Origin service identifier from RFC 7807 problem+json responses. Indicates which internal Wildberries service originated the error (e.g., "s2s-api-auth-catalog"). | WBAPIError.origin | errors/base-error.ts:43 |
<a id="timestamp"></a> timestamp? | readonly | string | ISO 8601 timestamp from RFC 7807 problem+json responses. Indicates when the error occurred on the server side (e.g., "2024-09-30T06:52:38Z"). | WBAPIError.timestamp | errors/base-error.ts:51 |
<a id="codetype"></a> codeType | readonly | "SGTIN" | "UIN" | "IMEI" | "GTIN" | Type of metadata code (SGTIN, UIN, IMEI, GTIN) | - | errors/in-store-pickup-errors.ts:256 |
<a id="orderid"></a> orderId | readonly | number | ID of the order for which metadata update failed | - | errors/in-store-pickup-errors.ts:257 |
Methods
toJSON()
toJSON(): {
name: string;
message: string;
statusCode?: number;
response?: unknown;
requestId?: string;
origin?: string;
timestamp?: string;
};Defined in: errors/base-error.ts:156
Custom JSON serialization to preserve all error properties.
By default, Error objects don't serialize the message property when using JSON.stringify(). This method ensures all important properties are included in the JSON output.
Returns
{
name: string;
message: string;
statusCode?: number;
response?: unknown;
requestId?: string;
origin?: string;
timestamp?: string;
}Object representation of the error for JSON serialization
| Name | Type | Defined in |
|---|---|---|
name | string | errors/base-error.ts:157 |
message | string | errors/base-error.ts:158 |
statusCode? | number | errors/base-error.ts:159 |
response? | unknown | errors/base-error.ts:160 |
requestId? | string | errors/base-error.ts:161 |
origin? | string | errors/base-error.ts:162 |
timestamp? | string | errors/base-error.ts:163 |
Example
const error = new WBAPIError('Test error', 400, { detail: 'info' }, 'req-123');
const json = JSON.stringify(error);
// { "name": "WBAPIError", "message": "Test error", "statusCode": 400, ... }Inherited from
getUserMessage()
getUserMessage(): string;Defined in: errors/in-store-pickup-errors.ts:277
Returns user-friendly error message with recovery guidance
Returns
string