{"record":{"id":"27aa2f549b671ba9","repo":"GoogleContainerTools/skaffold","slug":"docker-config-w","errorCode":null,"errorMessage":"docker config: %w","messagePattern":"docker config: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/docker/auth.go","lineNumber":86,"sourceCode":"\tif configDir == \"\" {\n\t\tconfigDir = filepath.Join(getHomeDir(), configFileDir)\n\t}\n}\n\n// AuthConfigHelper exists for testing purposes since GetAuthConfig shells out\n// to native store helpers.\n// Ideally this shouldn't be public, but the LocalBuilder needs to use it.\ntype AuthConfigHelper interface {\n\tGetAuthConfig(ctx context.Context, registry string) (types.AuthConfig, error)\n\tGetAllAuthConfigs(ctx context.Context) (map[string]types.AuthConfig, error)\n}\n\ntype credsHelper struct{}\n\nfunc loadDockerConfig() (*configfile.ConfigFile, error) {\n\tcf, err := config.Load(configDir)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"docker config: %w\", err)\n\t}\n\n\tgcp.AutoConfigureGCRCredentialHelper(cf)\n\n\treturn cf, nil\n}\n\nfunc (h credsHelper) GetAuthConfig(ctx context.Context, registry string) (types.AuthConfig, error) {\n\tcf, err := loadDockerConfig()\n\tif err != nil {\n\t\treturn types.AuthConfig{}, err\n\t}\n\n\treturn h.loadCredentials(ctx, cf, registry)\n}\n\nfunc (h credsHelper) loadCredentials(ctx context.Context, cf *configfile.ConfigFile, registry string) (types.AuthConfig, error) {\n\tif helper := cf.CredentialHelpers[registry]; helper == \"gcloud\" {","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/docker/auth.go#L68-L104","documentation":"Wraps a failure from dockercli config.Load(configDir) when loading the user's Docker config file (~/.docker/config.json). loadDockerConfig backs GetAuthConfig and doGetAllAuthConfigs, so any registry-auth operation fails if the Docker config is unreadable or invalid.","triggerScenarios":"GetAuthConfig or doGetAllAuthConfigs invoke loadDockerConfig; config.Load fails because the config file is missing, malformed JSON, unreadable, or configDir is invalid.","commonSituations":"Hand-edited ~/.docker/config.json with invalid JSON; config file with wrong permissions; corrupted Docker Desktop install; DOCKER_CONFIG pointing to a bad directory.","solutions":["Validate/fix ~/.docker/config.json (run `docker login` to regenerate it)","Check DOCKER_CONFIG env var points to the right directory","Fix file permissions on the Docker config file","Test with `docker config` / any docker CLI pull to confirm the CLI can load the config"],"exampleFix":"// before\n$ cat ~/.docker/config.json\n{\"auths\": {  // truncated JSON\n// after\n$ docker login  # regenerates valid ~/.docker/config.json\n{\"auths\": {}, \"credsStore\": \"desktop\"}","handlingStrategy":"try-catch","validationCode":"var cf configfile.ConfigFile\nif err := json.Unmarshal(b, &cf); err != nil { return err }","typeGuard":"func dockerConfigValid(path string) bool {\n  b, err := os.ReadFile(path)\n  return err == nil && json.Valid(b)\n}","tryCatchPattern":"cf, err := loadDockerConfig()\nif err != nil {\n  return fmt.Errorf(\"registry auth unavailable; check ~/.docker/config.json: %w\", err)\n}","preventionTips":["Avoid hand-editing ~/.docker/config.json; use `docker login`","Verify DOCKER_CONFIG points at a valid directory","Keep the docker CLI/config format up to date","Backup the config before credential-helper changes"],"tags":["docker","auth","config-file","json"],"backgroundTag":"docker-config-load-failed","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}