Interactive Brokers import errors and how to fix them
When IBKR refuses a request, MEDGE shows its error code and what to do. Type the code below, or find it in the full table. Most problems come from an expired token, an IP restriction or a wrong Query ID.
Find your error
Check your Flex Query before connecting
In Client Portal, run your Flex Query once (the arrow next to it), choose XML and download the file. Drop it here to see whether it has everything MEDGE needs and exactly what it would import.
Drop the XML file here, or
The file is read in your browser and never uploaded.
Every Flex Web Service error code
The codes and messages are IBKR’s own; the last column says what to do when importing into MEDGE. Codes marked “temporary” clear up by themselves: MEDGE already retries the ones that mean the report is still being prepared.
| Code | IBKR message | What to do |
|---|---|---|
| 1001temporary | Statement could not be generated at this time. Please try again shortly. | Temporary. MEDGE retries automatically; if it still fails, press Refresh after a minute. |
| 1003 | Statement is not available. | IBKR has no report for that period. Check that the query period is Last Business Day and that the account was open on that date. |
| 1004temporary | Statement is incomplete at this time. Please try again shortly. | Temporary, often around the end of the trading day. Try again in a few minutes. |
| 1005temporary | Settlement data is not ready at this time. Please try again shortly. | Temporary. Try again in a few minutes. |
| 1006temporary | FIFO P/L data is not ready at this time. Please try again shortly. | Temporary. Try again in a few minutes. |
| 1007temporary | MTM P/L data is not ready at this time. Please try again shortly. | Temporary. Try again in a few minutes. |
| 1008temporary | MTM and FIFO P/L data is not ready at this time. Please try again shortly. | Temporary. Try again in a few minutes. |
| 1009temporary | The server is under heavy load. Statement could not be generated at this time. Please try again shortly. | IBKR is busy. Try again in a few minutes. |
| 1010 | Legacy Flex Queries are no longer supported. Please convert over to Activity Flex. | Create a new Activity Flex Query with the Open Positions section and use its Query ID. |
| 1011 | Service account is inactive. | The Flex Web Service is not active for this account. Enable it in Flex Web Service Configuration. |
| 1012 | Token has expired. | Generate a new token in Client Portal (choose the longest validity) and connect again with it. |
| 1013 | IP restriction. | The token only works from some IP addresses. Generate a new token without IP restriction: MEDGE’s servers do not have a fixed address. |
| 1014 | Query is invalid. | Check the Query ID: it is the number next to your Flex Query in Client Portal, and the query must belong to the same user as the token. |
| 1015 | Token is invalid. | Paste the Current Token shown in Flex Web Service Configuration, without spaces. If you generated a new one since, use the new one. |
| 1016 | Account in invalid. | The account in the query is not valid for this token. Recreate the query with the accounts this user can access. |
| 1017 | Reference code is invalid. | The report reference expired before it was downloaded. Press Refresh to start again. |
| 1018temporary | Too many requests have been made from this token. Please try again shortly. Limited to one request per second, 10 requests per minute (per token). | Wait a minute. If another app uses the same token, its requests count too. |
| 1019temporary | Statement generation in progress. Please try again shortly. | Normal: IBKR is preparing the report and MEDGE waits for it. If it takes too long, press Refresh after a minute. |
| 1020 | Invalid request or unable to validate request. | Check token and Query ID for typos or extra characters, then connect again. |
| 1021temporary | Statement could not be retrieved at this time. Please try again shortly. | Temporary. Try again in a few minutes. |
| 1025temporary | Too many failed attempts. | IBKR has paused the token after repeated errors. Wait, fix the cause shown before (usually token or Query ID), then try once. |
Messages from MEDGE
- “The Flex Query has no Open Positions section”
- The query exists but does not include open positions. Edit it in Client Portal, add Open Positions at Summary level, save, and connect again.
- “Try again in N seconds”
- IBKR allows 10 requests a minute per token and one import uses several, so MEDGE allows one read a minute per account. Wait for the time shown.
- “Interactive Brokers is still preparing the report”
- IBKR did not finish the report within about half a minute. Press Refresh after a minute.
- “No stock or ETF positions found”
- The account holds only instruments MEDGE does not import (options, futures, bonds, cash) or the query covers a different account. They are listed under Not imported.
- A ticker box is empty
- MEDGE did not recognise the exchange of that position. Type the ticker in MEDGE format (for example VWCE.DE) or untick it to leave it out.
- “You can connect up to 10 broker accounts”
- Each MEDGE account holds up to 10 connections. Disconnect one you no longer use.
The correct Flex Query settings are in the import guide.
Questions
Why does IBKR say my token is invalid (1015)?
The token was copied incompletely, has extra spaces, or a newer token replaced it. Paste the Current Token shown in Client Portal under Flex Web Service Configuration.
How do I fix “Token has expired” (1012)?
Generate a new token in Client Portal, choosing the longest validity (up to one year), and connect again in MEDGE with the same Query ID: the old connection is replaced.
What does “IP restriction” (1013) mean?
The token was generated with a list of allowed IP addresses. MEDGE’s servers do not have a fixed address, so generate a new token with the IP field left empty.
Why is “Query is invalid” (1014)?
The Query ID is wrong or belongs to another user. Use the number shown next to the Flex Query in Client Portal, logged in with the same user that generated the token.
How often can I refresh the positions?
Once a minute per account. IBKR limits each token to one request per second and 10 per minute, and an import needs several requests.
Related
MEDGE Capital is not affiliated with Interactive Brokers. Interactive Brokers, IBKR, Client Portal and PortfolioAnalyst are trademarks of their owners. Educational content: not financial advice and not an investment recommendation. Risk disclaimer.