{"id":"1d51844427403302","repo":"docker/cli","slug":"missing-mandatory-field-s","errorCode":null,"errorMessage":"missing mandatory field '%s'","messagePattern":"missing mandatory field '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"opts/swarmopts/port.go","lineNumber":101,"sourceCode":"\t\t\t\tpConfig.TargetPort = uint32(tPort)\n\t\t\tcase portOptPublishedPort:\n\t\t\t\tpPort, err := strconv.ParseUint(val, 10, 16)\n\t\t\t\tif err != nil {\n\t\t\t\t\tvar numErr *strconv.NumError\n\t\t\t\t\tif errors.As(err, &numErr) {\n\t\t\t\t\t\terr = numErr.Err\n\t\t\t\t\t}\n\t\t\t\t\treturn fmt.Errorf(\"invalid published port (%s): value must be an integer: %w\", val, err)\n\t\t\t\t}\n\n\t\t\t\tpConfig.PublishedPort = uint32(pPort)\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\"invalid field key: %s\", key)\n\t\t\t}\n\t\t}\n\n\t\tif pConfig.TargetPort == 0 {\n\t\t\treturn fmt.Errorf(\"missing mandatory field '%s'\", portOptTargetPort)\n\t\t}\n\n\t\tp.ports = append(p.ports, pConfig)\n\t} else {\n\t\t// short syntax ([ip:]public:private[/proto])\n\t\t//\n\t\t// TODO(thaJeztah): we need an equivalent that handles the \"ip-address\" part without depending on the nat package.\n\t\tports, portBindingMap, err := nat.ParsePortSpecs([]string{value})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, portBindings := range portBindingMap {\n\t\t\tfor _, portBinding := range portBindings {\n\t\t\t\tif portBinding.HostIP != \"\" {\n\t\t\t\t\treturn errors.New(\"hostip is not supported\")\n\t\t\t\t}\n\t\t\t}\n\t\t}","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/opts/swarmopts/port.go#L83-L119","documentation":"Error \"missing mandatory field '%s'\" thrown in docker/cli.","triggerScenarios":"Thrown at opts/swarmopts/port.go:101 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}