vxcontrol/pentagi · error

no config found for container %s

Error message

no config found for container %s

What it means

RunContainer requires a non-nil *container.Config describing the image/env/command for the sandbox; without it there is nothing to send to the daemon. When config is nil the function returns the plain error "no config found for container <name>". Unlike the other errors in this file, it carries no wrapped cause — it is a caller programming error, not an I/O failure.

Source

Thrown at backend/pkg/docker/client.go:222

		network:        netName,
		publicIP:       publicIP,
		portsBase:      cfg.DockerPortsBase,
		labels:         cfg.TenantLabels(),
		insideEnv:      cfg.WorkerDockerEnv(),
		insideCertPath: cfg.WorkerDockerCertPath(),
	}, nil
}

func (dc *dockerClient) RunContainer(
	ctx context.Context,
	containerName string,
	containerType database.ContainerType,
	flowID int64,
	config *container.Config,
	hostConfig *container.HostConfig,
) (database.Container, error) {
	if config == nil {
		return database.Container{}, fmt.Errorf("no config found for container %s", containerName)
	}

	workDir := filepath.Join(dc.dataDir, fmt.Sprintf(containerLocalCwdTemplate, flowID))
	if err := os.MkdirAll(workDir, 0755); err != nil {
		return database.Container{}, fmt.Errorf("failed to create tmp directory: %w", err)
	}

	hostDir := dc.hostDir
	if hostDir != "" {
		hostDir = filepath.Join(hostDir, fmt.Sprintf(containerLocalCwdTemplate, flowID))
	}

	logger := dc.logger.WithContext(ctx).WithFields(logrus.Fields{
		"image":    config.Image,
		"name":     containerName,
		"type":     containerType,
		"flow_id":  flowID,
		"work_dir": workDir,

View on GitHub (pinned to ea665308ba)

Solutions

  1. Fix the caller to always construct and pass &container.Config{Image: ...} before calling RunContainer.
  2. If config is conditionally built, check the builder's error return and propagate it instead of passing nil.
  3. Default to the client's default image when no specific config is needed: &container.Config{Image: dc.GetDefaultImage()}.
  4. Add a unit test covering the call site so nil configs fail fast in CI.

Example fix

// before
var cfg *container.Config // built later, nil on early return
dbContainer, err := dc.RunContainer(ctx, name, ctype, flowID, cfg, hostCfg)
// after
cfg, err := buildContainerConfig(tool, flowID)
if err != nil { return nil, err }
dbContainer, err := dc.RunContainer(ctx, name, ctype, flowID, cfg, hostCfg)
Defensive patterns

Strategy: type-guard

Validate before calling

if cfg == nil {
    cfg = &container.Config{Image: defaultImage} // or return a clear error at the call site
}

Type guard

func validContainerConfig(cfg *container.Config) bool {
    return cfg != nil && cfg.Image != ""
}
// usage: if !validContainerConfig(cfg) { return fmt.Errorf("container config/image required") }

Prevention

When it happens

Trigger: RunContainer(ctx, containerName, containerType, flowID, nil, hostConfig) is called with a nil config — e.g. a code path that builds hostConfig (port bindings, capabilities) but fails to build config.Image/Env, or a variable holding the config that was never initialized on some branch.

Common situations: Adding a new tool/agent code path that passes an uninitialized *container.Config; a refactor moving config construction behind a helper that returns nil on error paths that were ignored; tests calling RunContainer with only a hostConfig.

Related errors


AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01). Data as JSON: /api/errors/7091cd8565b7bdd5. Report an issue: GitHub.