{"id":"6cf14ac4e8ade265","repo":"docker/cli","slug":"invalid-field-s-must-be-a-key-value-pair-6cf14a","errorCode":null,"errorMessage":"invalid field '%s' must be a key=value pair","messagePattern":"invalid field '(.+?)' must be a key=value pair","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"opts/swarmopts/config.go","lineNumber":46,"sourceCode":"\t\tFile: &swarm.ConfigReferenceFileTarget{\n\t\t\tUID:  \"0\",\n\t\t\tGID:  \"0\",\n\t\t\tMode: 0o444,\n\t\t},\n\t}\n\n\t// support a simple syntax of --config foo\n\tif len(fields) == 1 && !strings.Contains(fields[0], \"=\") {\n\t\toptions.File.Name = fields[0]\n\t\toptions.ConfigName = fields[0]\n\t\to.values = append(o.values, options)\n\t\treturn nil\n\t}\n\n\tfor _, field := range fields {\n\t\tkey, val, ok := strings.Cut(field, \"=\")\n\t\tif !ok || key == \"\" {\n\t\t\treturn fmt.Errorf(\"invalid field '%s' must be a key=value pair\", field)\n\t\t}\n\n\t\t// TODO(thaJeztah): these options should not be case-insensitive.\n\t\tswitch strings.ToLower(key) {\n\t\tcase \"source\", \"src\":\n\t\t\toptions.ConfigName = val\n\t\tcase \"target\":\n\t\t\toptions.File.Name = val\n\t\tcase \"uid\":\n\t\t\toptions.File.UID = val\n\t\tcase \"gid\":\n\t\t\toptions.File.GID = val\n\t\tcase \"mode\":\n\t\t\tm, err := strconv.ParseUint(val, 0, 32)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"invalid mode specified: %v\", err)\n\t\t\t}\n","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/opts/swarmopts/config.go#L28-L64","documentation":"Error \"invalid field '%s' must be a key=value pair\" thrown in docker/cli.","triggerScenarios":"Thrown at opts/swarmopts/config.go:46 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}