{"record":{"id":"0332a1d6acf7a3c8","repo":"docker/cli","slug":"unknown-server-os-s","errorCode":null,"errorMessage":"unknown server OS: %s","messagePattern":"unknown server OS: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/container/opts.go","lineNumber":1003,"sourceCode":"\t\tk, v, ok := strings.Cut(option, \"=\")\n\t\tif !ok {\n\t\t\treturn nil, errors.New(\"invalid storage option\")\n\t\t}\n\t\tm[k] = v\n\t}\n\treturn m, nil\n}\n\n// parseDevice parses a device mapping string to a container.DeviceMapping struct\nfunc parseDevice(device, serverOS string) (container.DeviceMapping, error) {\n\tswitch serverOS {\n\tcase \"linux\":\n\t\treturn parseLinuxDevice(device)\n\tcase \"windows\":\n\t\t// Windows doesn't support mapping, so passing the given value as-is.\n\t\treturn container.DeviceMapping{PathOnHost: device}, nil\n\tdefault:\n\t\treturn container.DeviceMapping{}, fmt.Errorf(\"unknown server OS: %s\", serverOS)\n\t}\n}\n\n// parseLinuxDevice parses a device mapping string to a container.DeviceMapping struct\n// knowing that the target is a Linux daemon\nfunc parseLinuxDevice(device string) (container.DeviceMapping, error) {\n\tvar src, dst string\n\tpermissions := \"rwm\"\n\t// We expect 3 parts at maximum; limit to 4 parts to detect invalid options.\n\tarr := strings.SplitN(device, \":\", 4)\n\tswitch len(arr) {\n\tcase 3:\n\t\tpermissions = arr[2]\n\t\tfallthrough\n\tcase 2:\n\t\tif validDeviceMode(arr[1]) {\n\t\t\tpermissions = arr[1]\n\t\t} else {","sourceCodeStart":985,"sourceCodeEnd":1021,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/command/container/opts.go#L985-L1021","documentation":"Thrown by parseDevice when the server OS type reported by the daemon is neither 'linux' nor 'windows'. The function switches on serverOS and only handles those two; any other value reaches the default case.","triggerScenarios":"Passing --device while connected to a daemon whose Ping OSType returns something other than 'linux' or 'windows'. The OSType comes from the daemon's Ping response and is passed through from serverInfo.OSType.","commonSituations":"Connected to a daemon in an unsupported/unusual environment; a custom or buggy daemon returning an empty or non-standard OSType; version mismatch between an old/new client and daemon; connecting to a non-Docker API endpoint that partially answers Ping.","solutions":["Check the daemon: docker version and docker info to see the OS/Server info","Connect to a daemon whose OSType is linux or windows","Drop the --device flag if the target daemon does not support device mapping","Verify you are pointing at a real Docker/Moby daemon and not a proxy"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm daemon OS before issuing device flags.\ninfo, err := cli.ServerVersion(ctx)\nif err != nil {\n    return err\n}\nif info.Os != \"linux\" && info.Os != \"windows\" {\n    return fmt.Errorf(\"unsupported daemon OS %q for --device\", info.Os)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Gate device-related flags behind an OS check in your orchestration scripts","Document which daemon OS each workload targets"],"tags":["docker","device","server-os","compatibility"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}