[GH-ISSUE #203] Flow creation fails with "failed to get primary docker image: network error: failed to reach API server" even though OpenAI API works #78

Closed
opened 2026-06-06 22:08:59 -04:00 by yindo · 2 comments
Owner

Originally created by @lockens on GitHub (Mar 12, 2026).
Original GitHub issue: https://github.com/vxcontrol/pentagi/issues/203

Problem

Creating a new flow fails with:

failed to get primary docker image: network error: failed to reach API server

The flow is written to the database but the worker container never starts.


Environment

PentAGI: 1.1.0-e97bbe5
Host: Kali Linux
Docker: 27.5.1
Install method: docker-compose


OpenAI connectivity test

OpenAI API is reachable from both the main container and worker containers.

Example test from container:

wget -S -qO- --header="Authorization: Bearer $OPEN_AI_KEY" https://api.openai.com/v1/models

Result:

HTTP/1.1 200 OK


Configuration

.env

OPEN_AI_KEY=***
OPEN_AI_SERVER_URL=https://api.openai.com/v1

LLM_SERVER_PROVIDER=openai
LLM_SERVER_MODEL=gpt-4o-mini
LLM_SERVER_URL=https://api.openai.com/v1
LLM_SERVER_KEY=***

DOCKER_ENV_LLM_SERVER_PROVIDER=openai
DOCKER_ENV_LLM_SERVER_MODEL=gpt-4o-mini
DOCKER_ENV_LLM_SERVER_URL=https://api.openai.com/v1
DOCKER_ENV_LLM_SERVER_KEY=***


Logs

flow created in DB flow_id=11 provider_name=openai provider_type=openai

failed to get flow provider
error="failed to get primary docker image: network error: failed to reach API server"

graphql request handled with errors
createAssistant failed to create flow worker


Observation

Worker containers start but environment variables appear empty:

LLM_SERVER_URL=
LLM_SERVER_MODEL=
LLM_SERVER_PROVIDER=
LLM_SERVER_KEY=

Even though they are correctly set in the main container.


Question

Is this related to the automatic Docker image selection step, or is there additional configuration required for worker containers to inherit LLM_SERVER_* variables?

Originally created by @lockens on GitHub (Mar 12, 2026). Original GitHub issue: https://github.com/vxcontrol/pentagi/issues/203 ## Problem Creating a new flow fails with: failed to get primary docker image: network error: failed to reach API server The flow is written to the database but the worker container never starts. --- ## Environment PentAGI: 1.1.0-e97bbe5 Host: Kali Linux Docker: 27.5.1 Install method: docker-compose --- ## OpenAI connectivity test OpenAI API is reachable from both the main container and worker containers. Example test from container: wget -S -qO- --header="Authorization: Bearer $OPEN_AI_KEY" https://api.openai.com/v1/models Result: HTTP/1.1 200 OK --- ## Configuration .env OPEN_AI_KEY=*** OPEN_AI_SERVER_URL=https://api.openai.com/v1 LLM_SERVER_PROVIDER=openai LLM_SERVER_MODEL=gpt-4o-mini LLM_SERVER_URL=https://api.openai.com/v1 LLM_SERVER_KEY=*** DOCKER_ENV_LLM_SERVER_PROVIDER=openai DOCKER_ENV_LLM_SERVER_MODEL=gpt-4o-mini DOCKER_ENV_LLM_SERVER_URL=https://api.openai.com/v1 DOCKER_ENV_LLM_SERVER_KEY=*** --- ## Logs flow created in DB flow_id=11 provider_name=openai provider_type=openai failed to get flow provider error="failed to get primary docker image: network error: failed to reach API server" graphql request handled with errors createAssistant failed to create flow worker --- ## Observation Worker containers start but environment variables appear empty: LLM_SERVER_URL= LLM_SERVER_MODEL= LLM_SERVER_PROVIDER= LLM_SERVER_KEY= Even though they are correctly set in the main container. --- ## Question Is this related to the automatic Docker image selection step, or is there additional configuration required for worker containers to inherit `LLM_SERVER_*` variables?
yindo closed this issue 2026-06-06 22:08:59 -04:00
Author
Owner

@lockens commented on GitHub (Mar 12, 2026):

Additional debug information.

PentAGI logs

service ssl crt and key already exist
time="2026-03-12T22:43:27Z" level=info msg="Starting PentAGI 1.1.0-e97bbe5"
2026/03/12 22:43:27 goose: no migrations to run. current version: 20260223
2026/03/12 22:43:27 Migrations ran successfully

time="2026-03-12T22:43:55Z" level=info msg="flow created in DB" flow_id=9 provider_name=openai provider_type=openai user_id=1
time="2026-03-12T22:43:55Z" level=error msg="failed to get flow provider" error="failed to get primary docker image: network error: failed to reach API server"
time="2026-03-12T22:43:55Z" level=error msg="graphql request handled with errors" component=pentagi-gql duration=21.352083ms gql.errors="input: createFlow failed to create flow worker: failed to get flow provider: failed to get primary docker image: network error: failed to reach API server\n" operation_name=createFlow operation_type=mutation

time="2026-03-12T22:44:15Z" level=info msg="flow created in DB" flow_id=10 provider_name=openai provider_type=openai user_id=1
time="2026-03-12T22:44:15Z" level=error msg="failed to get flow provider" error="failed to get primary docker image: network error: failed to reach API server"
time="2026-03-12T22:44:15Z" level=error msg="graphql request handled with errors" component=pentagi-gql duration=5.593065ms gql.errors="input: createAssistant failed to create flow worker: failed to get flow provider: failed to get primary docker image: network error: failed to reach API server\n" operation_name=createAssistant operation_type=mutation

time="2026-03-12T22:46:52Z" level=info msg="flow created in DB" flow_id=11 provider_name=openai provider_type=openai user_id=1
time="2026-03-12T22:46:52Z" level=error msg="failed to get flow provider" error="failed to get primary docker image: network error: failed to reach API server"
time="2026-03-12T22:46:52Z" level=error msg="graphql request handled with errors" component=pentagi-gql duration=26.727557ms gql.errors="input: createAssistant failed to create flow worker: failed to get flow provider: failed to get primary docker image: network error: failed to reach API server\n" operation_name=createAssistant operation_type=mutation

Relevant env values:

LLM_SERVER_PROVIDER=openai
LLM_SERVER_MODEL=gpt-4o-mini
LLM_SERVER_URL=https://api.openai.com/v1
LLM_SERVER_KEY=***REDACTED***
OPEN_AI_KEY=***REDACTED***
OPEN_AI_SERVER_URL=https://api.openai.com/v1

DOCKER_ENV_LLM_SERVER_PROVIDER=openai
DOCKER_ENV_LLM_SERVER_MODEL=gpt-4o-mini
DOCKER_ENV_LLM_SERVER_URL=https://api.openai.com/v1
DOCKER_ENV_LLM_SERVER_KEY=***REDACTED***

DOCKER_NETWORK=
DOCKER_DEFAULT_IMAGE=
DOCKER_DEFAULT_IMAGE_FOR_PENTEST=


langfuse-network
observability-network
pentagi-network

OPEN_AI_KEY=***REDACTED***
OPEN_AI_SERVER_URL=https://api.openai.com/v1

LLM_SERVER_URL=
LLM_SERVER_MODEL=
LLM_SERVER_PROVIDER=
LLM_SERVER_KEY=

LLM_SERVER_CONFIG_PATH=
LLM_SERVER_LEGACY_REASONING=
LLM_SERVER_PRESERVE_REASONING=

The main PentAGI container has the correct LLM_SERVER_* and DOCKER_ENV_LLM_SERVER_* values set.

However, the worker/run container starts with OPEN_AI_KEY present but all LLM_SERVER_* values empty.

This seems to match the flow creation failure:
failed to get primary docker image: network error: failed to reach API server

```markdown
I can also confirm that OpenAI is reachable from the run container with a direct authenticated request to `https://api.openai.com/v1/models` returning HTTP 200.
<!-- gh-comment-id:4050890501 --> @lockens commented on GitHub (Mar 12, 2026): Additional debug information. ### PentAGI logs ```text service ssl crt and key already exist time="2026-03-12T22:43:27Z" level=info msg="Starting PentAGI 1.1.0-e97bbe5" 2026/03/12 22:43:27 goose: no migrations to run. current version: 20260223 2026/03/12 22:43:27 Migrations ran successfully time="2026-03-12T22:43:55Z" level=info msg="flow created in DB" flow_id=9 provider_name=openai provider_type=openai user_id=1 time="2026-03-12T22:43:55Z" level=error msg="failed to get flow provider" error="failed to get primary docker image: network error: failed to reach API server" time="2026-03-12T22:43:55Z" level=error msg="graphql request handled with errors" component=pentagi-gql duration=21.352083ms gql.errors="input: createFlow failed to create flow worker: failed to get flow provider: failed to get primary docker image: network error: failed to reach API server\n" operation_name=createFlow operation_type=mutation time="2026-03-12T22:44:15Z" level=info msg="flow created in DB" flow_id=10 provider_name=openai provider_type=openai user_id=1 time="2026-03-12T22:44:15Z" level=error msg="failed to get flow provider" error="failed to get primary docker image: network error: failed to reach API server" time="2026-03-12T22:44:15Z" level=error msg="graphql request handled with errors" component=pentagi-gql duration=5.593065ms gql.errors="input: createAssistant failed to create flow worker: failed to get flow provider: failed to get primary docker image: network error: failed to reach API server\n" operation_name=createAssistant operation_type=mutation time="2026-03-12T22:46:52Z" level=info msg="flow created in DB" flow_id=11 provider_name=openai provider_type=openai user_id=1 time="2026-03-12T22:46:52Z" level=error msg="failed to get flow provider" error="failed to get primary docker image: network error: failed to reach API server" time="2026-03-12T22:46:52Z" level=error msg="graphql request handled with errors" component=pentagi-gql duration=26.727557ms gql.errors="input: createAssistant failed to create flow worker: failed to get flow provider: failed to get primary docker image: network error: failed to reach API server\n" operation_name=createAssistant operation_type=mutation Relevant env values: LLM_SERVER_PROVIDER=openai LLM_SERVER_MODEL=gpt-4o-mini LLM_SERVER_URL=https://api.openai.com/v1 LLM_SERVER_KEY=***REDACTED*** OPEN_AI_KEY=***REDACTED*** OPEN_AI_SERVER_URL=https://api.openai.com/v1 DOCKER_ENV_LLM_SERVER_PROVIDER=openai DOCKER_ENV_LLM_SERVER_MODEL=gpt-4o-mini DOCKER_ENV_LLM_SERVER_URL=https://api.openai.com/v1 DOCKER_ENV_LLM_SERVER_KEY=***REDACTED*** DOCKER_NETWORK= DOCKER_DEFAULT_IMAGE= DOCKER_DEFAULT_IMAGE_FOR_PENTEST= langfuse-network observability-network pentagi-network OPEN_AI_KEY=***REDACTED*** OPEN_AI_SERVER_URL=https://api.openai.com/v1 LLM_SERVER_URL= LLM_SERVER_MODEL= LLM_SERVER_PROVIDER= LLM_SERVER_KEY= LLM_SERVER_CONFIG_PATH= LLM_SERVER_LEGACY_REASONING= LLM_SERVER_PRESERVE_REASONING= The main PentAGI container has the correct LLM_SERVER_* and DOCKER_ENV_LLM_SERVER_* values set. However, the worker/run container starts with OPEN_AI_KEY present but all LLM_SERVER_* values empty. This seems to match the flow creation failure: failed to get primary docker image: network error: failed to reach API server ```markdown I can also confirm that OpenAI is reachable from the run container with a direct authenticated request to `https://api.openai.com/v1/models` returning HTTP 200.
Author
Owner

@asdek commented on GitHub (Mar 19, 2026):

hey @lockens

thanks for the detailed report! i can see the issue now.

the problem: your .env configuration mixes native OpenAI setup with custom provider settings, and includes unsupported DOCKER_ENV_* variables that don't exist in PentAGI's configuration system.

solution:

  1. remove all DOCKER_ENV_* variables - these are not part of PentAGI's standard configuration and should be deleted from your .env file

  2. choose one configuration approach based on your setup:

option A: native OpenAI (recommended for verified organizations)

# remove these lines:
# LLM_SERVER_PROVIDER=openai
# LLM_SERVER_MODEL=gpt-4o-mini
# LLM_SERVER_URL=https://api.openai.com/v1
# LLM_SERVER_KEY=***
# DOCKER_ENV_LLM_SERVER_PROVIDER=openai
# DOCKER_ENV_LLM_SERVER_MODEL=gpt-4o-mini
# DOCKER_ENV_LLM_SERVER_URL=https://api.openai.com/v1
# DOCKER_ENV_LLM_SERVER_KEY=***

# keep only:
OPEN_AI_KEY=your_actual_openai_key
OPEN_AI_SERVER_URL=https://api.openai.com/v1

option B: custom provider (for unverified OpenAI organizations)

if your OpenAI account doesn't have access to latest reasoning models (o1, o3, o4-mini), use this instead:

# remove OPEN_AI_KEY and OPEN_AI_SERVER_URL

LLM_SERVER_URL=https://api.openai.com/v1
LLM_SERVER_KEY=your_openai_api_key
LLM_SERVER_MODEL=
LLM_SERVER_CONFIG_PATH=/opt/pentagi/conf/custom-openai.provider.yml
LLM_SERVER_LEGACY_REASONING=true

see the unverified organizations guide for details.

note: LLM_SERVER_PROVIDER=openai is only needed when using LiteLLM proxy where model names have prefixes like openai/gpt-4o-mini. if you're connecting directly to OpenAI's API, don't use this variable.

  1. recreate containers:
docker compose down
docker compose up -d --force-recreate
  1. test the configuration:
docker exec -it pentagi ./bin/ctester -agents all -verbose -groups basic -type openai --workers 2

this will verify that all agents can connect to your LLM provider correctly.

let me know if you still see the network error after these changes!

<!-- gh-comment-id:4093573817 --> @asdek commented on GitHub (Mar 19, 2026): hey @lockens thanks for the detailed report! i can see the issue now. **the problem**: your `.env` configuration mixes native OpenAI setup with custom provider settings, and includes unsupported `DOCKER_ENV_*` variables that don't exist in PentAGI's configuration system. **solution**: 1. **remove all `DOCKER_ENV_*` variables** - these are not part of PentAGI's standard configuration and should be deleted from your `.env` file 2. **choose one configuration approach** based on your setup: **option A: native OpenAI (recommended for verified organizations)** ```bash # remove these lines: # LLM_SERVER_PROVIDER=openai # LLM_SERVER_MODEL=gpt-4o-mini # LLM_SERVER_URL=https://api.openai.com/v1 # LLM_SERVER_KEY=*** # DOCKER_ENV_LLM_SERVER_PROVIDER=openai # DOCKER_ENV_LLM_SERVER_MODEL=gpt-4o-mini # DOCKER_ENV_LLM_SERVER_URL=https://api.openai.com/v1 # DOCKER_ENV_LLM_SERVER_KEY=*** # keep only: OPEN_AI_KEY=your_actual_openai_key OPEN_AI_SERVER_URL=https://api.openai.com/v1 ``` **option B: custom provider (for unverified OpenAI organizations)** if your OpenAI account doesn't have access to latest reasoning models (o1, o3, o4-mini), use this instead: ```bash # remove OPEN_AI_KEY and OPEN_AI_SERVER_URL LLM_SERVER_URL=https://api.openai.com/v1 LLM_SERVER_KEY=your_openai_api_key LLM_SERVER_MODEL= LLM_SERVER_CONFIG_PATH=/opt/pentagi/conf/custom-openai.provider.yml LLM_SERVER_LEGACY_REASONING=true ``` see the [unverified organizations guide](https://github.com/vxcontrol/pentagi?tab=readme-ov-file#using-openai-with-unverified-organizations) for details. **note**: `LLM_SERVER_PROVIDER=openai` is only needed when using **LiteLLM proxy** where model names have prefixes like `openai/gpt-4o-mini`. if you're connecting directly to OpenAI's API, don't use this variable. 3. **recreate containers**: ```bash docker compose down docker compose up -d --force-recreate ``` 4. **test the configuration**: ```bash docker exec -it pentagi ./bin/ctester -agents all -verbose -groups basic -type openai --workers 2 ``` this will verify that all agents can connect to your LLM provider correctly. let me know if you still see the network error after these changes!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vxcontrol/pentagi#78