Skip to content

Wildberries API TypeScript SDK / BidOutOfRangeError

Class: BidOutOfRangeError

Defined in: errors/bid-out-of-range-error.ts:137

Error thrown when WB rejects a bid for being out of the accepted range.

Wildberries advert endpoints reject out-of-range bids with an HTTP 400 whose RFC 7807 body looks like:

json
{
  "detail": "wrong bid value: 3; min: 150",
  "title": "invalid payload",
  "status": 400
}

BaseClient detects this shape and throws BidOutOfRangeError instead of a generic ValidationError, exposing the parsed floor (and ceiling when reported) directly. This is high-value for auto-bidding engines: the canonical minimum is available from the error itself, avoiding a separate getBidsRecommendations round-trip (which is capped at 5 req/min).

This error is a subclass of ValidationError, so existing catch (error) { if (error instanceof ValidationError) ... } blocks still catch it — the change is purely additive.

The received/min/max numeric unit depends on which endpoint rejected the bid: kopecks for updateBids, RUB for setNormqueryBids.

Example

typescript
import { BidOutOfRangeError } from 'daytona-wildberries-typescript-sdk';

try {
  await sdk.promotion.updateBids({
    bids: [{ advert_id: 12345, nm_bids: [{ nm_id: 1, bid_kopecks: 3, placement: 'search' }] }]
  });
} catch (error) {
  if (error instanceof BidOutOfRangeError) {
    console.error(`Bid ${error.received} below minimum ${error.min}`);
    // Retry at error.min (the canonical floor)
  }
}

See

InvalidBidError for the broader bid-validation sibling (legacy; not thrown by BaseClient — reserved for caller-side validation).

Extends

Constructors

Constructor

ts
new BidOutOfRangeError(
   message: string, 
   context?: {
  received?: number;
  min?: number;
  max?: number;
  field?: string;
}, 
   response?: unknown, 
   requestId?: string): BidOutOfRangeError;

Defined in: errors/bid-out-of-range-error.ts:155

Creates a BidOutOfRangeError.

Parameters

ParameterTypeDescription
messagestringError message (typically the raw WB detail string)
context?{ received?: number; min?: number; max?: number; field?: string; }Parsed bid-range context (received/min/max) plus optional field
context.received?number-
context.min?number-
context.max?number-
context.field?string-
response?unknownAPI response body if available
requestId?stringCorrelation ID for debugging

Returns

BidOutOfRangeError

Overrides

ValidationError.constructor

Properties

PropertyModifierTypeDescriptionInherited fromDefined in
<a id="statuscode"></a> statusCode?readonlynumberHTTP status code if applicableValidationError.statusCodeerrors/base-error.ts:25
<a id="response"></a> response?readonlyunknownAPI response body if availableValidationError.responseerrors/base-error.ts:30
<a id="requestid"></a> requestId?readonlystringCorrelation ID for debugging and tracing requestsValidationError.requestIderrors/base-error.ts:35
<a id="origin"></a> origin?readonlystringOrigin service identifier from RFC 7807 problem+json responses. Indicates which internal Wildberries service originated the error (e.g., "s2s-api-auth-catalog").ValidationError.originerrors/base-error.ts:43
<a id="timestamp"></a> timestamp?readonlystringISO 8601 timestamp from RFC 7807 problem+json responses. Indicates when the error occurred on the server side (e.g., "2024-09-30T06:52:38Z").ValidationError.timestamperrors/base-error.ts:51
<a id="received"></a> received?readonlynumberThe bid value WB rejected (the "wrong bid value").-errors/bid-out-of-range-error.ts:139
<a id="min"></a> min?readonlynumberThe minimum accepted bid (the floor).-errors/bid-out-of-range-error.ts:142
<a id="max"></a> max?readonlynumberThe maximum accepted bid (the ceiling), only when WB reports one.-errors/bid-out-of-range-error.ts:145
<a id="fielderrors"></a> fieldErrors?readonlyRecord<string, string>Map of field names to their validation error messagesValidationError.fieldErrorserrors/validation-error.ts:39

Methods

getUserMessage()

ts
getUserMessage(): string;

Defined in: errors/bid-out-of-range-error.ts:180

Returns a user-friendly error message with the accepted bid range.

Returns

string

Error message naming the rejected bid and the accepted floor/ceiling

Overrides

ValidationError.getUserMessage


toJSON()

ts
toJSON(): {
  name: string;
  message: string;
  statusCode: number;
  fieldErrors?: Record<string, string>;
  received?: number;
  min?: number;
  max?: number;
  response?: unknown;
  requestId?: string;
};

Defined in: errors/bid-out-of-range-error.ts:215

Custom JSON serialization to preserve bid-range fields.

Returns

ts
{
  name: string;
  message: string;
  statusCode: number;
  fieldErrors?: Record<string, string>;
  received?: number;
  min?: number;
  max?: number;
  response?: unknown;
  requestId?: string;
}

Object representation including received/min/max

NameTypeDefined in
namestringerrors/bid-out-of-range-error.ts:216
messagestringerrors/bid-out-of-range-error.ts:217
statusCodenumbererrors/bid-out-of-range-error.ts:218
fieldErrors?Record<string, string>errors/bid-out-of-range-error.ts:219
received?numbererrors/bid-out-of-range-error.ts:220
min?numbererrors/bid-out-of-range-error.ts:221
max?numbererrors/bid-out-of-range-error.ts:222
response?unknownerrors/bid-out-of-range-error.ts:223
requestId?stringerrors/bid-out-of-range-error.ts:224

Overrides

ValidationError.toJSON

Made with ❤️ for the Wildberries developer community