Troubleshooting

Common Bot Failures and How to Diagnose Them

A field guide to common automation failures: rejected orders, stale sessions, missing data, duplicate events, restart loops and silent bots.

Humorous illustration of a frustrated trader and confused bot facing falling charts
Illustration: debugging often feels like this; the useful part is reducing the problem to one layer at a time.

A field guide to common automation failures: rejected orders, stale sessions, missing data, duplicate events, restart loops and silent bots.

Updated 2026-09-06TroubleshootingPractical guide2 min read

In plain English

This guide turns a vague “the bot did nothing” problem into layers you can inspect: input, validation, state, external API, response, persistence and monitoring.

logstimestamplayer isolationreproduction
Practical example

Start with the first broken layer

If “the bot did nothing,” first prove whether an input arrived. Then prove validation, decision logic, broker request, broker response and persistence in that order. Do not debug all layers at once.

1. Order rejected by broker

Log the exact broker reason and request context. Check market status, account permissions, instrument identifier, size, margin and conflicting positions. Do not hide rejection details behind a generic order_failed.

2. Session expired

Centralize authentication so all broker calls share one session manager. A bot that recreates sessions independently in several loops can hit login rate limits and create races.

3. “No trades” but service is active

Check last market-data timestamp, signal counts, rejection counters and current thresholds. Process status alone does not prove data is flowing.

4. Duplicate execution after timeout

Use event IDs and reconciliation. After an uncertain write, query broker state before resending.

5. Restart loop

Use a restart delay and inspect the first error after startup. Later errors may only be consequences.

6. Learning/update job times out

Profile the slow section, reduce repeated database scans, cache static inputs, batch work and put a hard maximum on data ranges. Faster code is useful only if it produces the same validated result.

7. Missing shell tool

A missing CLI such as sqlite3 does not necessarily mean the language runtime cannot access the same format. Diagnose capability at the layer the application actually uses.

Before you rely on this in production

  • The failing layer is isolated before changing parameters.
  • Timestamps and request IDs are collected.
  • One change is tested at a time.
  • Retries are avoided when the previous external action is uncertain.
Real failure examples

Three failures from actual build sessions

MetaEditor compiler errors from an MQL5 Expert Advisor
Compile failure

MQL5 code that did not compile

Undeclared identifiers, enum conversion problems and wrong parameter counts had to be fixed before strategy testing could even begin.

DigitalOcean droplet agent failure message
Infrastructure failure

Droplet console unavailable

The web console failed because the droplet agent was not running. Infrastructure failures are separate from strategy failures and need separate diagnostics.

Unauthorized unable to authenticate error in terminal output
Auth failure

Authentication rejected

An “Unable to authenticate you” response is a reminder that credentials, sessions and environments need explicit handling and useful logging.

Identifying browser and droplet details were removed from the published infrastructure screenshots.