Skip to content

Notifications subsystem initializes unexpectedly in Docker even with no notifier env; crashes with "dial tcp :0" #2209

@Linon419

Description

@Linon419

Describe the bug
When running bbgo in Docker or CLI, the notifications subsystem initializes even when no notifier variables are present and no notifications: block is in the config. It prints a Telegram OTP and then exits with:

vbnet
Copy code
Error: notification configure error: dial tcp :0: connect: connection refused

Environment

Host OS: Debian (Docker host)

CPU arch: arm64 (aarch64)

Timezone: Australia/Sydney

Docker: recent CLI + Compose

Redis: redis:alpine (internal network only)

bbgo image:

Broken: newer images (e.g. yoanlin/bbgo:latest as of 2025-09-13 AEST)

Minimal docker-compose.yml


services:
  bbgo:
    image: yoanlin/bbgo:latest   # broken; works if pinned to sha-981c703
    container_name: bbgo-trading
    restart: unless-stopped
    volumes:
      - ./bbgo.yaml:/config/bbgo.yaml:ro
      - ./safe.env:/config/safe.env:ro
      # also mounted to overwrite default lookup path
      - ./safe.env:/home/bbgo/.env.local:ro
      - ./data:/home/bbgo/data
      - ./logs:/home/bbgo/logs
    environment:
      - TZ=Australia/Sydney
      - DISABLE_MARKET_CACHE=1
    command: ["run", "--config", "/config/bbgo.yaml", "--dotenv", "/config/safe.env", "--enable-webserver", "--debug"]
    ports:
      - "8356:8080"
    depends_on: [redis]
    networks: [bbgo-network]

  redis:
    image: redis:alpine
    container_name: bbgo-redis
    restart: unless-stopped
    # no host port exposed; only internal
    volumes:
      - redis_data:/data
    networks: [bbgo-network]

volumes:
  redis_data:

networks:
  bbgo-network:
    driver: bridge

safe.env (dotenv used by --dotenv and also as /home/bbgo/.env.local)


BINANCE_API_KEY=***redacted***
BINANCE_API_SECRET=***redacted***
PAPER_TRADE=1
Note: there are no TELEGRAM_*, SLACK_*, SMTP_*, WEBHOOK_*, or NOTIFY* variables anywhere.

bbgo.yaml (minimal; no notifications: block present)

persistence:
  redis:
    enabled: true
    addr: "bbgo-redis:6379"
    db: 0

sessions:
  binance:
    exchange: binance
    envVarPrefix: BINANCE

exchangeStrategies:
- on: binance
  supertrend:
    symbol: BTCUSDT
    interval: 5m
    window: 70
    supertrendMultiplier: 4.0
    leverage: 1.0
    drawGraph: false

Steps to reproduce

Create the files above in a clean directory (bbgo.yaml, safe.env, docker-compose.yml).

docker compose up -d

docker compose logs -f bbgo

Actual behavior (logs excerpt)

sql

... debug mode is enabled
... [redis] get key "bbgo:auth:<id>", data =  persistence=redis
... telegram session not found, generating new one-time password key for new telegram session...
====================================================================
  PLEASE STORE YOUR OTP KEY SAFELY
  Issuer:       <hex>
  AccountName:  bbgo
  Secret:       <secret>
  Key URL:      otpauth://totp/<...>
====================================================================
Error: notification configure error: dial tcp :0: connect: connection refused
FATAL cannot execute command error=dial tcp :0: connect: connection refused

This happens even though:

There is no notifications: block in bbgo.yaml.

The dotenv file contains only BINANCE_* and PAPER_TRADE, and is passed explicitly with --dotenv /config/safe.env.

We also mount the same dotenv to /home/bbgo/.env.local to prevent default discovery from picking up anything else.

Redis is clean (we deleted bbgo:auth*, bbgo:telegram* keys before starting).

Expected behavior
With no notifier-related env and no notifications: config, the notifications subsystem should not initialize and should not attempt any network connections. bbgo should start the webserver and strategies normally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions