{"id":"cc8dd768c6b6ca31","repo":"docker/cli","slug":"loading-config-file-w","errorCode":null,"errorMessage":"loading config file: %w","messagePattern":"loading config file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/config/config.go","lineNumber":145,"sourceCode":"\tif configDir == \"\" {\n\t\tconfigDir = Dir()\n\t}\n\treturn load(configDir)\n}\n\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","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/config/config.go#L127-L163","documentation":"Error \"loading config file: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/config/config.go:145 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}