{"id":"76c7c660d730764d","repo":"docker/cli","slug":"parsing-config-file-s-w","errorCode":null,"errorMessage":"parsing config file (%s): %w","messagePattern":"parsing config file \\((.+?)\\): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/config/config.go","lineNumber":150,"sourceCode":"\nfunc load(configDir string) (*configfile.ConfigFile, error) {\n\tfilename := filepath.Join(configDir, ConfigFileName)\n\tconfigFile := configfile.New(filename)\n\n\tfile, err := os.Open(filename)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\t// It is OK for no configuration file to be present, in which\n\t\t\t// case we return a default struct.\n\t\t\treturn configFile, nil\n\t\t}\n\t\t// Any other error happening when failing to read the file must be returned.\n\t\treturn configFile, fmt.Errorf(\"loading config file: %w\", err)\n\t}\n\tdefer func() { _ = file.Close() }()\n\terr = configFile.LoadFromReader(file)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"parsing config file (%s): %w\", filename, err)\n\t}\n\treturn configFile, err\n}\n\n// LoadDefaultConfigFile attempts to load the default config file and returns\n// a reference to the ConfigFile struct. If none is found or when failing to load\n// the configuration file, it initializes a default ConfigFile struct. If no\n// credentials-store is set in the configuration file, it attempts to discover\n// the default store to use for the current platform.\n//\n// Important: LoadDefaultConfigFile prints a warning to stderr when failing to\n// load the configuration file, but otherwise ignores errors. Consumers should\n// consider using [Load] (and [credentials.DetectDefaultStore]) to detect errors\n// when updating the configuration file, to prevent discarding a (malformed)\n// configuration file.\nfunc LoadDefaultConfigFile(stderr io.Writer) *configfile.ConfigFile {\n\tconfigFile, err := load(Dir())\n\tif err != nil {","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/config/config.go#L132-L168","documentation":"Error \"parsing config file (%s): %w\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/config/config.go:150 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}