vxcontrol/pentagi · error
failed to get absolute path: %w
Error message
failed to get absolute path: %w
What it means
During NewDockerClient, the configured data directory (cfg.DataDir, e.g. DATA_DIR env) is converted to an absolute path with filepath.Abs before it is created and bind-mounted into worker containers. filepath.Abs essentially only fails when os.Getwd() fails, meaning the process's current working directory has been deleted or is unreadable. The error is wrapped as "failed to get absolute path: %w" and aborts client construction.
Source
Thrown at backend/pkg/docker/client.go:167
"to the configured external daemon at %q.", cfg.DockerInsideHost)
default:
logrus.Warn("DOCKER_INSIDE=true with neither DOCKER_SOCKET nor DOCKER_INSIDE_HOST set: " +
"the host Docker socket will be autodetected and bind-mounted into every worker " +
"container, so any process inside it gets control of the same daemon that runs " +
"PentAGI. Set DOCKER_SOCKET or DOCKER_INSIDE_HOST explicitly, or front the socket " +
"with a least-privilege proxy (e.g. Tecnativa/docker-socket-proxy), if that is not intended.")
}
}
netName := cfg.DockerNetwork
publicIP := cfg.DockerPublicIP
defImage := strings.ToLower(cfg.DockerDefaultImage)
if defImage == "" {
defImage = defaultImage
}
dataDir, err := filepath.Abs(cfg.DataDir)
if err != nil {
return nil, fmt.Errorf("failed to get absolute path: %w", err)
}
if err := os.MkdirAll(dataDir, 0755); err != nil {
return nil, fmt.Errorf("failed to create tmp directory: %w", err)
}
hostDir := getHostDataDir(ctx, cli, dataDir, cfg.DockerWorkDir)
// ensure network exists if configured
if err := ensureDockerNetwork(ctx, cli, netName); err != nil {
return nil, fmt.Errorf("failed to ensure docker network %s: %w", netName, err)
}
logger := logrus.StandardLogger()
logger.WithFields(logrus.Fields{
"docker_name": info.Name,
"docker_arch": info.Architecture,
"docker_version": info.ServerVersion,View on GitHub (pinned to ea665308ba)
Solutions
- Restart the process from a valid working directory (cd /app && ./pentagi).
- Set DATA_DIR to an absolute path so filepath.Abs never needs to resolve against cwd (it then only fails if Getwd fails, but avoid the dependency).
- Check that the launch directory exists and is readable (ls -la $(pwd)).
- If running under systemd/Docker, ensure WorkingDirectory points to an existing directory.
Example fix
// before golang DATA_DIR=data ./pentagi # started in ./data's parent which was deleted // after export DATA_DIR=/var/lib/pentagi/data # absolute path /var/lib/pentagi/pentagi
Defensive patterns
Strategy: validation
Validate before calling
if _, err := os.Stat(cfg.DataDir); err == nil {
// path exists; additionally ensure cwd is valid
if _, err := os.Getwd(); err != nil {
return fmt.Errorf("process cwd is invalid: %w", err)
}
} Try / catch
if _, err := NewDockerClient(ctx, db, cfg); err != nil {
var pe *fs.PathError
if errors.As(err, &pe) && strings.Contains(err.Error(), "absolute path") {
log.Fatalf("cwd invalid for DATA_DIR resolution: %v — restart from an existing directory", err)
}
return err
} Prevention
- Always configure DATA_DIR as an absolute path.
- Launch the binary from a stable WorkingDirectory (systemd WorkingDirectory, Docker WORKDIR).
- Avoid deleting directories a running process may be using as cwd.
- Add a pre-start check that os.Getwd() succeeds.
When it happens
Trigger: filepath.Abs(cfg.DataDir) returns an error because os.Getwd() fails — the process was started in a directory that was subsequently removed or the cwd is inaccessible (permission, stale NFS mount). Also possible with a corrupt/unreadable cwd after container image changes.
Common situations: Starting the binary from a directory that was deleted while the process was running; launching via a wrapper script that cd's into a temp dir that vanished; running with a restricted cwd in a hardened sandbox; DATA_DIR passed as a relative path and cwd resolution failing.
Related errors
- failed to create tmp directory: %w
- failed to load flows: %w
- failed to get docker info: %w
- failed to ensure docker network %s: %w
- failed to stat container path '%s': %w
AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01).
Data as JSON: /api/errors/32a1802124763a91.
Report an issue: GitHub.