{"id":"1640a4542163d954","repo":"docker/cli","slug":"invalid-range-format-for-expose-w","errorCode":null,"errorMessage":"invalid range format for --expose: %w","messagePattern":"invalid range format for --expose: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/container/opts.go","lineNumber":474,"sourceCode":"\t}\n\n\t// Add published ports as exposed ports.\n\texposedPorts := network.PortSet{}\n\tfor port := range ports {\n\t\tp, err := network.ParsePort(string(port))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\texposedPorts[p] = struct{}{}\n\t}\n\n\t// Merge in exposed ports to the map of published ports\n\tfor _, e := range copts.expose.GetSlice() {\n\t\t// support two formats for expose, original format <portnum>/[<proto>]\n\t\t// or <startport-endport>/[<proto>]\n\t\tpr, err := network.ParsePortRange(e)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid range format for --expose: %w\", err)\n\t\t}\n\t\t// parse the start and end port and create a sequence of ports to expose\n\t\t// if expose a port, the start and end port are the same\n\t\tfor p := range pr.All() {\n\t\t\texposedPorts[p] = struct{}{}\n\t\t}\n\t}\n\n\t// validate and parse device mappings. Note we do late validation of the\n\t// device path (as opposed to during flag parsing), as at the time we are\n\t// parsing flags, we haven't yet sent a _ping to the daemon to determine\n\t// what operating system it is.\n\tdevices := copts.devices.GetSlice()\n\tdeviceMappings := make([]container.DeviceMapping, 0, len(devices))\n\tcdiDeviceNames := make([]string, 0, len(devices))\n\tfor _, device := range devices {\n\t\tif cdi.IsQualifiedName(device) {\n\t\t\tcdiDeviceNames = append(cdiDeviceNames, device)","sourceCodeStart":456,"sourceCodeEnd":492,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/container/opts.go#L456-L492","documentation":"Error \"invalid range format for --expose: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/command/container/opts.go:474 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}