docker/cli ยท error

parsing config file (%s): %w

Error message

parsing config file (%s): %w

What it means

Error "parsing config file (%s): %w" thrown in docker/cli.

Source

Thrown at cli/config/config.go:150

func load(configDir string) (*configfile.ConfigFile, error) {
	filename := filepath.Join(configDir, ConfigFileName)
	configFile := configfile.New(filename)

	file, err := os.Open(filename)
	if err != nil {
		if os.IsNotExist(err) {
			// It is OK for no configuration file to be present, in which
			// case we return a default struct.
			return configFile, nil
		}
		// Any other error happening when failing to read the file must be returned.
		return configFile, fmt.Errorf("loading config file: %w", err)
	}
	defer func() { _ = file.Close() }()
	err = configFile.LoadFromReader(file)
	if err != nil {
		err = fmt.Errorf("parsing config file (%s): %w", filename, err)
	}
	return configFile, err
}

// LoadDefaultConfigFile attempts to load the default config file and returns
// a reference to the ConfigFile struct. If none is found or when failing to load
// the configuration file, it initializes a default ConfigFile struct. If no
// credentials-store is set in the configuration file, it attempts to discover
// the default store to use for the current platform.
//
// Important: LoadDefaultConfigFile prints a warning to stderr when failing to
// load the configuration file, but otherwise ignores errors. Consumers should
// consider using [Load] (and [credentials.DetectDefaultStore]) to detect errors
// when updating the configuration file, to prevent discarding a (malformed)
// configuration file.
func LoadDefaultConfigFile(stderr io.Writer) *configfile.ConfigFile {
	configFile, err := load(Dir())
	if err != nil {

View on GitHub (pinned to e9452d6e78)

When it happens

Trigger: Thrown at cli/config/config.go:150 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/76c7c660d730764d.json. Report an issue: GitHub.