{"record":{"id":"7437eadfcac52ddc","repo":"docker/cli","slug":"docker-auth-config-does-not-support-more-than-one","errorCode":null,"errorMessage":"DOCKER_AUTH_CONFIG does not support more than one JSON object","messagePattern":"DOCKER_AUTH_CONFIG does not support more than one JSON object","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/config/configfile/file.go","lineNumber":361,"sourceCode":"\t\tmemorystore.WithFallbackStore(store),\n\t)\n\tif err != nil {\n\t\t_, _ = fmt.Fprintln(os.Stderr, \"Failed to create credential store from DOCKER_AUTH_CONFIG: \", err)\n\t\treturn store\n\t}\n\n\treturn envStore\n}\n\nfunc parseEnvConfig(v string) (map[string]types.AuthConfig, error) {\n\tenvConfig := &configEnv{}\n\tdecoder := json.NewDecoder(strings.NewReader(v))\n\tdecoder.DisallowUnknownFields()\n\tif err := decoder.Decode(envConfig); err != nil && !errors.Is(err, io.EOF) {\n\t\treturn nil, err\n\t}\n\tif decoder.More() {\n\t\treturn nil, errors.New(\"DOCKER_AUTH_CONFIG does not support more than one JSON object\")\n\t}\n\n\tauthConfigs := make(map[string]types.AuthConfig)\n\tfor addr, envAuth := range envConfig.AuthConfigs {\n\t\tif envAuth.Auth == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"DOCKER_AUTH_CONFIG environment variable is missing key `auth` for %s\", addr)\n\t\t}\n\t\tusername, password, err := decodeAuth(envAuth.Auth)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tauthConfigs[addr] = types.AuthConfig{\n\t\t\tUsername:      username,\n\t\t\tPassword:      password,\n\t\t\tServerAddress: addr,\n\t\t}\n\t}\n\treturn authConfigs, nil","sourceCodeStart":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/config/configfile/file.go#L343-L379","documentation":"Returned by parseEnvConfig when parsing DOCKER_AUTH_CONFIG: after successfully decoding one JSON object, decoder.More() reports additional trailing data. The env var is intentionally restricted to a single JSON object ({\"auths\":{...}}); concatenated or multiple top-level objects are rejected to avoid ambiguous credential resolution.","triggerScenarios":"Setting DOCKER_AUTH_CONFIG to two JSON objects concatenated, e.g. '{...}{...}', or to a JSON array/stream. Attempting to merge multiple registries by pasting two full config documents into one env var.","commonSituations":"CI pipelines that build DOCKER_AUTH_CONFIG by concatenating per-registry JSON blobs. Copying two registry auth blocks separated by a newline into the same variable. Templating systems emitting repeated top-level objects.","solutions":["Merge all registries into a single JSON object under one 'auths' key: {\"auths\":{\"reg1\":{\"auth\":\"...\"},\"reg2\":{\"auth\":\"...\"}}}.","Remove trailing whitespace/objects after the first JSON document.","Validate the value with: echo \"$DOCKER_AUTH_CONFIG\" | jq type (should print 'object')."],"exampleFix":"# before\nDOCKER_AUTH_CONFIG='{\"auths\":{\"reg1\":{\"auth\":\"x\"}}}{\"auths\":{\"reg2\":{\"auth\":\"y\"}}}'\n# after\nDOCKER_AUTH_CONFIG='{\"auths\":{\"reg1\":{\"auth\":\"x\"},\"reg2\":{\"auth\":\"y\"}}}'","handlingStrategy":"validation","validationCode":"// Ensure DOCKER_AUTH_CONFIG is a single JSON object before use.\nfunc validateAuthEnv(v string) error {\n    dec := json.NewDecoder(strings.NewReader(v))\n    var o any\n    if err := dec.Decode(&o); err != nil { return err }\n    if dec.More() { return errors.New(\"more than one JSON object in DOCKER_AUTH_CONFIG\") }\n    if _, ok := o.(map[string]any); !ok { return errors.New(\"DOCKER_AUTH_CONFIG must be a JSON object\") }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Merge multiple registries under one 'auths' object.","Pipe the value through 'jq type' in CI to confirm it is 'object'.","Never concatenate two JSON documents in the same env var."],"tags":["config","auth","environment","docker-auth-config","validation"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}