{"record":{"id":"38a5e436c31ace6f","repo":"vxcontrol/pentagi","slug":"runtime-verification-failed-w","errorCode":null,"errorMessage":"runtime verification failed: %w","messagePattern":"runtime verification failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"backend/pkg/tools/terminal.go","lineNumber":206,"sourceCode":"}\n\nfunc (t *terminal) ExecCommand(\n\tctx context.Context,\n\tcwd, command string,\n\tdetach bool,\n\ttimeout time.Duration,\n) (string, error) {\n\tcontainerName := PrimaryTerminalName(t.tenantPrefix, t.flowID)\n\n\tcmd := []string{\n\t\t\"sh\",\n\t\t\"-c\",\n\t\tcommand,\n\t}\n\n\tisRunning, err := t.dockerClient.IsContainerRunning(ctx, t.containerLID)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"runtime verification failed: %w\", err)\n\t}\n\tif !isRunning {\n\t\treturn \"\", fmt.Errorf(\"container runtime is not operational\")\n\t}\n\n\tif cwd == \"\" {\n\t\tcwd = docker.WorkFolderPathInContainer\n\t}\n\n\t// Format command with working directory and ANSI styling\n\tstyledCommand := fmt.Sprintf(\"%s $ %s%s%s%s\", cwd, ansiColorInputCmd, command, ansiColorReset, ansiLineTerminator)\n\t_, err = t.tlp.PutMsg(ctx, database.TermlogTypeStdin, styledCommand, t.containerID, t.taskID, t.subtaskID)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to put terminal log (stdin): %w\", err)\n\t}\n\n\ttimeout = t.normalizeExecTimeout(timeout)\n","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/vxcontrol/pentagi/blob/ea665308baaff015b226f308438a68d929d0f29b/backend/pkg/tools/terminal.go#L188-L224","documentation":"ExecCommand first verifies the sandbox container is alive by calling dockerClient.IsContainerRunning. If that check itself errors (Docker API unreachable, container ID unknown, context canceled), the call fails with \"runtime verification failed: %w\" wrapping the underlying Docker error.","triggerScenarios":"Calling ExecCommand (directly or via Handle/exec tool) when the Docker daemon is down, the container ID (containerLID) is stale or removed, or the context is canceled/timed out during the Docker API call.","commonSituations":"Docker daemon restarted or host rebooted; container garbage-collected between flow steps; Docker socket permission issues; network partition to a remote Docker host.","solutions":["Inspect the wrapped %w cause with errors.Unwrap or %v to see the actual Docker error","Verify the container exists and is up: docker ps / docker inspect <containerLID>","Check Docker daemon availability and socket permissions (docker info)","Recreate the terminal container if the ID is stale, then retry"],"exampleFix":"// before\nout, err := term.ExecCommand(ctx, cwd, cmd, false, timeout) // runtime verification failed: ...\n// after\nif err := term.Ping(ctx); err != nil {\n    term.Recreate(ctx) // re-provision sandbox before executing\n}\nout, err := term.ExecCommand(ctx, cwd, cmd, false, timeout)","handlingStrategy":"retry","validationCode":"if err := dockerClient.Ping(ctx); err != nil {\n    return fmt.Errorf(\"docker unavailable before exec: %w\", err)\n}\nrunning, err := dockerClient.IsContainerRunning(ctx, containerLID)\nif err != nil || !running {\n    return fmt.Errorf(\"terminal container not ready: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"out, err := term.ExecCommand(ctx, cwd, cmd, false, timeout)\nif err != nil && strings.HasPrefix(err.Error(), \"runtime verification failed:\") {\n    // transient Docker issue — backoff and retry after checking daemon health\n    select {\n    case <-time.After(2 * time.Second):\n        out, err = term.ExecCommand(ctx, cwd, cmd, false, timeout)\n    case <-ctx.Done():\n        return ctx.Err()\n    }\n}","preventionTips":["Health-check the Docker daemon and container before flow steps","Use context timeouts on Docker calls so hangs surface as cancellation, not deadlock","Monitor containerLID validity; re-provision the sandbox if it disappears","Alert on Docker socket permission/availability changes in the deployment"],"tags":["docker","container","network","infrastructure"],"backgroundTag":"docker-daemon-unreachable","analyzedSha":"ea665308baaff015b226f308438a68d929d0f29b","analyzedAt":"2026-09-01T14:16:31.421Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}