{"id":"ede2215cd357af90","repo":"docker/cli","slug":"failed-to-read-credentials-from-docker-auth-config","errorCode":null,"errorMessage":"failed to read credentials from DOCKER_AUTH_CONFIG: %w","messagePattern":"failed to read credentials from DOCKER_AUTH_CONFIG: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/container/auth_config_utils.go","lineNumber":33,"sourceCode":"//\n//   - If a valid \"DOCKER_AUTH_CONFIG\" env-var is found, and it contains\n//     credentials, it's value is used.\n//   - If no \"DOCKER_AUTH_CONFIG\" env-var is found, or it does not contain\n//     credentials, it attempts to read from the CLI's credentials store.\n//\n// It returns an error if either the \"DOCKER_AUTH_CONFIG\" is incorrectly\n// formatted, or when failing to read from the credentials store.\n//\n// A nil value is returned if neither option contained any credentials.\nfunc readCredentials(dockerCLI config.Provider) (creds map[string]types.AuthConfig, _ error) {\n\tif v, ok := os.LookupEnv(\"DOCKER_AUTH_CONFIG\"); ok && v != \"\" {\n\t\t// The results are expected to have been unmarshaled the same as\n\t\t// when reading from a config-file, which includes decoding the\n\t\t// base64-encoded \"username:password\" into the \"UserName\" and\n\t\t// \"Password\" fields.\n\t\tac := &configfile.ConfigFile{}\n\t\tif err := ac.LoadFromReader(strings.NewReader(v)); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to read credentials from DOCKER_AUTH_CONFIG: %w\", err)\n\t\t}\n\t\tif len(ac.AuthConfigs) > 0 {\n\t\t\treturn ac.AuthConfigs, nil\n\t\t}\n\t}\n\n\t// Resolve this here for later, ensuring we error our before we create the container.\n\tcreds, err := dockerCLI.ConfigFile().GetAllCredentials()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"resolving credentials failed: %w\", err)\n\t}\n\treturn creds, nil\n}\n","sourceCodeStart":15,"sourceCodeEnd":47,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/container/auth_config_utils.go#L15-L47","documentation":"Error \"failed to read credentials from DOCKER_AUTH_CONFIG: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/command/container/auth_config_utils.go:33 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}