docker/cli ยท error
error closing temp file: %w
Error message
error closing temp file: %w
What it means
Error "error closing temp file: %w" thrown in docker/cli.
Source
Thrown at cli/config/configfile/file.go:226
return err
}
defer func() {
// ignore error as the file may already be closed when we reach this.
_ = temp.Close()
if retErr != nil {
if err := os.Remove(temp.Name()); err != nil {
logrus.WithError(err).WithField("file", temp.Name()).Debug("Error cleaning up temp file")
}
}
}()
err = c.SaveToWriter(temp)
if err != nil {
return err
}
if err := temp.Close(); err != nil {
return fmt.Errorf("error closing temp file: %w", err)
}
// Handle situation where the configfile is a symlink, and allow for dangling symlinks
cfgFile := c.Filename
if f, err := filepath.EvalSymlinks(cfgFile); err == nil {
cfgFile = f
} else if os.IsNotExist(err) {
// extract the path from the error if the configfile does not exist or is a dangling symlink
var pathError *os.PathError
if errors.As(err, &pathError) {
cfgFile = pathError.Path
}
}
// Try copying the current config file (if any) ownership and permissions
copyFilePermissions(cfgFile, temp.Name())
return os.Rename(temp.Name(), cfgFile)
}View on GitHub (pinned to e9452d6e78)
When it happens
Trigger: Thrown at cli/config/configfile/file.go:226 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01).
Data as JSON: /data/errors/a5980a36609c6478.json.
Report an issue: GitHub.