vxcontrol/pentagi · error
failed to get all containers: %w
Error message
failed to get all containers: %w
What it means
After successfully fetching flows, Cleanup fetches all container rows via GetContainers to build the status map; a failure here is wrapped with this message. Cleanup aborts before touching any container.
Source
Thrown at backend/pkg/docker/client.go:796
}
logger.Info("container removed")
return nil
}
func (dc *dockerClient) Cleanup(ctx context.Context) error {
logger := dc.logger.WithContext(ctx).WithField("docker", "cleanup")
logger.Info("cleaning up containers and making all flows finished...")
flows, err := dc.db.GetFlows(ctx)
if err != nil {
return fmt.Errorf("failed to get all flows: %w", err)
}
containers, err := dc.db.GetContainers(ctx)
if err != nil {
return fmt.Errorf("failed to get all containers: %w", err)
}
flowsStatusMap := make(map[int64]database.FlowStatus)
for _, flow := range flows {
flowsStatusMap[flow.ID] = flow.Status
}
flowContainersMap := make(map[int64][]database.Container)
for _, container := range containers {
flowContainersMap[container.FlowID] = append(flowContainersMap[container.FlowID], container)
}
var wg sync.WaitGroup
removeContainer := func(containerID string, dbID int64) {
defer wg.Done()
logger := logger.WithField("local_id", containerID)
if err := dc.RemoveContainer(ctx, containerID, dbID); err != nil {
logger.WithError(err).Errorf("failed to remove container")View on GitHub (pinned to ea665308ba)
Solutions
- Confirm DB health and re-run Cleanup once connectivity is restored
- Check locks on the containers table and resolve blocking transactions
- Verify goose migrations are up to date for the containers schema
- Wrap the fetch sequence in a retry with backoff since both reads are idempotent
Defensive patterns
Strategy: retry
Try / catch
if err := dc.Cleanup(ctx); err != nil {
if strings.Contains(err.Error(), "failed to get all containers") {
time.Sleep(retryDelay)
return dc.Cleanup(ctx)
}
return err
} Prevention
- Fetch flows and containers with a consistent snapshot (single transaction) if staleness matters
- Keep connection-pool limits above concurrent cleanup load
- Apply migrations before Cleanup runs
- Alert on lock waits on the containers table
When it happens
Trigger: dc.db.GetContainers fails during Cleanup: DB connection lost between the two queries, lock/timeout on the containers table, or schema mismatch.
Common situations: Flaky DB connection dropping mid-Cleanup; long-running transaction locking containers; migration drift leaving the containers table inconsistent; pool exhaustion under heavy teardown load.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- failed to get all flows: %w
- failed to create tool call log: %w
- failed to update tool call log result: %w
- failed to update tool call log failed result: %w
- failed to create termlog: %w
AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01).
Data as JSON: /api/errors/a5e643d8f01c998d.
Report an issue: GitHub.