vxcontrol/pentagi · critical
container runtime is not operational
Error message
container runtime is not operational
What it means
After the Docker check succeeds, ExecCommand refuses to run if IsContainerRunning reports the terminal container is not running. The literal message "container runtime is not operational" means the sandbox for this flow is stopped/exited, so no command can be executed.
Source
Thrown at backend/pkg/tools/terminal.go:209
ctx context.Context,
cwd, command string,
detach bool,
timeout time.Duration,
) (string, error) {
containerName := PrimaryTerminalName(t.tenantPrefix, t.flowID)
cmd := []string{
"sh",
"-c",
command,
}
isRunning, err := t.dockerClient.IsContainerRunning(ctx, t.containerLID)
if err != nil {
return "", fmt.Errorf("runtime verification failed: %w", err)
}
if !isRunning {
return "", fmt.Errorf("container runtime is not operational")
}
if cwd == "" {
cwd = docker.WorkFolderPathInContainer
}
// Format command with working directory and ANSI styling
styledCommand := fmt.Sprintf("%s $ %s%s%s%s", cwd, ansiColorInputCmd, command, ansiColorReset, ansiLineTerminator)
_, err = t.tlp.PutMsg(ctx, database.TermlogTypeStdin, styledCommand, t.containerID, t.taskID, t.subtaskID)
if err != nil {
return "", fmt.Errorf("failed to put terminal log (stdin): %w", err)
}
timeout = t.normalizeExecTimeout(timeout)
createResp, err := t.dockerClient.ContainerExecCreate(ctx, containerName, client.ExecCreateOptions{
Cmd: cmd,
AttachStdout: true,View on GitHub (pinned to ea665308ba)
Solutions
- Start the container again: docker start <container> (or recreate it via the platform's flow/terminal provisioning)
- Check why it exited: docker inspect -f '{{.State.ExitCode}} {{.State.Error}}' <container> and container logs
- If the container was removed, re-create the terminal for the flow and retry the command
Example fix
// before
out, err := term.ExecCommand(ctx, cwd, cmd, false, timeout) // container runtime is not operational
// after
if running, _ := docker.IsContainerRunning(ctx, lid); !running {
if err := term.EnsureRunning(ctx); err != nil { return err } // restart/recreate sandbox
}
out, err := term.ExecCommand(ctx, cwd, cmd, false, timeout) Defensive patterns
Strategy: fallback
Validate before calling
running, err := dockerClient.IsContainerRunning(ctx, containerLID)
if err != nil {
return fmt.Errorf("cannot verify container: %w", err)
}
if !running {
return fmt.Errorf("terminal container %s is stopped; start or recreate it before executing", containerLID)
} Try / catch
out, err := term.ExecCommand(ctx, cwd, cmd, false, timeout)
if err != nil && err.Error() == "container runtime is not operational" {
if rerr := term.EnsureRunning(ctx); rerr != nil { // restart/recreate fallback
return fmt.Errorf("sandbox restart failed: %w", rerr)
}
out, err = term.ExecCommand(ctx, cwd, cmd, false, timeout)
} Prevention
- Use restart policies (e.g. on-flow keepalive) so sandboxes don't silently exit
- Track container exit events and recreate the terminal proactively
- Check exit codes/logs when a container dies to fix the root cause (OOM, bad entrypoint)
- Don't hold flow references to containers removed by external cleanup jobs
When it happens
Trigger: ExecCommand called when the flow's terminal container has exited — it crashed, was stopped manually, OOM-killed, finished its entrypoint, or was removed by a reaper while the flow still references it.
Common situations: Long-running flow whose sandbox exited between steps; container stopped via docker stop during debugging; image entrypoint exiting immediately after creation; resource limits (OOM) killing the container mid-flow.
Related errors
- runtime verification failed: %w
- failed to create exec process: %w
- failed to read current content of %s before editing: %w
- failed to attach file-check exec: %w
- failed to read file-check output: %w
AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01).
Data as JSON: /api/errors/b3aa7e5c08cb735d.
Report an issue: GitHub.