Repository navigation
Error Reference
⚠️ Generated page — do not edit by hand. Runmake wikito regenerate.
The server surfaces these error types. The safety-refusal errors (TradingDisabledError, EpicNotAllowedError, DryRunError, ConfirmRequiredError, RiskLimitError) are expected guardrails, not bugs — they mean the safety model blocked a request.
| Error | Meaning |
|---|---|
BrokerError |
Broker rejected the request. |
ConfigError |
Configuration error. |
ConfigMissingError |
Required configuration (credentials) is missing. |
ConfirmRequiredError |
Explicit confirmation is required. |
DryRunError |
Dry-run mode is enabled. |
EpicNotAllowedError |
Epic is not in the allowlist. |
PreviewError |
Preview-related error. |
RateLimitError |
Rate limit exceeded. |
RiskLimitError |
Risk limit exceeded. |
SessionError |
Session-related error. |
TradingDisabledError |
Trading is disabled. |
UpstreamError |
Upstream API error. |
Errors from broker-backed tools reach the client as <CODE>: <message>, for example PREVIEW_ALREADY_USED: Preview … was already executed …. The cap_stream_* tools return errors as data (error, code, message; code is the same SDK code, or null when the failure was not an SDK error), and resource reads are not prefixed. Match on the code rather than the message text.
| Code | Meaning |
|---|---|
CONFIG_MISSING |
Required credentials (CAP_API_KEY, CAP_IDENTIFIER, CAP_API_PASSWORD) are not configured. |
CONFIG_INVALID |
A configuration value is present but invalid, or a CAP_*_CMD credential command failed. |
TRADING_DISABLED |
Trading is switched off; set CAP_ALLOW_TRADING=true to enable it. |
DRY_RUN_ENABLED |
Dry-run mode is on, so executions are refused; set CAP_DRY_RUN=false to allow them. |
CONFIRM_REQUIRED |
The call needs explicit confirmation; call the tool again with confirm=true. |
EPIC_NOT_ALLOWED |
Reserved by the SDK for an instrument outside CAP_ALLOWED_EPICS; today such a preview fails its epic_allowed check and executing it returns PREVIEW_CHECKS_FAILED. |
RISK_LIMIT |
The account already holds the maximum number of open positions (CAP_MAX_OPEN_POSITIONS). |
SESSION_EXPIRED |
The broker session could not be established or kept, or the WebSocket stream is not connected. |
SESSION_NOT_INITIALIZED |
There is no logged-in session yet ("Not logged in"). |
AUTH_FAILED |
The broker answered 401 or 403, even after one automatic re-login on read requests. |
STREAMING_DISABLED |
Live streaming is off (CAP_WS_ENABLED is false), so a cap_stream_* tool cannot open its WebSocket; returned as data with this code. |
RATE_LIMITED_LOCAL |
The local rate limiter could not grant a request slot in time; slow down and retry. |
BROKER_REJECTED |
Reserved by the SDK for broker rejections; these currently surface as UPSTREAM_ERROR with the HTTP status in the message. |
UPSTREAM_ERROR |
The Capital.com API returned an HTTP error response (including broker rejections, shown as HTTP 4xx: ...), or the request failed after its retries (timeouts included), or the WebSocket connection failed. |
UPSTREAM_TIMEOUT |
Reserved by the SDK for an upstream timeout; request timeouts currently surface as UPSTREAM_ERROR. |
PREVIEW_NOT_FOUND |
No preview exists with that id. |
PREVIEW_EXPIRED |
The preview is older than its lifetime (CAP_PREVIEW_CACHE_TTL_S); create a new one. |
PREVIEW_CHECKS_FAILED |
The preview's safety checks did not all pass (for example the size limit, the allowlist or a closed market), so it cannot be executed; the message lists each failed check. Fix the cause and create a new preview. |
PREVIEW_ALREADY_USED |
The preview was already executed; create a new preview to trade again. |
PREVIEW_ACCOUNT_MISMATCH |
The preview was created on a different account from the active one; switch back to that account or create a new preview. |
INVALID_REQUEST |
Arguments failed validation and the call was refused locally, before anything was sent to the broker (for example an amendment with nothing to change). |
NOT_FOUND |
The position or working order to amend could not be read from the broker, so nothing was sent. |
INTERNAL_ERROR |
An unexpected local error, for example the shared SDK state file is locked by another process. |
INVALID_DURATION |
A cap_stream_* tool was asked for a duration_s outside the allowed range; returned as data with this code, before any stream is opened. |
Unofficial · not affiliated with Capital.com · not financial advice · demo-first. See Safety Model.
Getting Started
Reference
- Tools Reference
- Resources Reference
- Prompts Reference
- Configuration Reference
- Error Reference
- API Stability
Guides
Contributing