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
- Fix the caller to always construct and pass &container.Config{Image: ...} before calling RunContainer.
- If config is conditionally built, check the builder's error return and propagate it instead of passing nil.
- Default to the client's default image when no specific config is needed: &container.Config{Image: dc.GetDefaultImage()}.
- 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
- Never declare *container.Config without initializing it; construct inline at the call site.
- Have builders of configs return (config, error) and check err before calling RunContainer.
- Add a linter/test that exercises every RunContainer call path with a non-nil config.
- Use a small wrapper function that validates config before delegating to RunContainer.
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
- Internal
- failed to stop flow %d: %w
- failed to create extension %q in schema %q (a privileged use
- failed to initialize docker client: %w
- failed to get docker info: %w
AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01).
Data as JSON: /api/errors/7091cd8565b7bdd5.
Report an issue: GitHub.