{"record":{"id":"0cbf27b3891bb550","repo":"lima-vm/lima","slug":"invalid-interface-q-for-network-q-w","errorCode":null,"errorMessage":"invalid interface %#q for network %#q: %w","messagePattern":"invalid interface %#q for network %#q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/networks/validate.go","lineNumber":45,"sourceCode":"\t// for non-bridged networks, and group defaults to \"admin\" when unset, so\n\t// only validate those when a value is actually present.\n\tif c.Group != \"\" {\n\t\tif err := identifiers.Validate(c.Group); err != nil {\n\t\t\treturn fmt.Errorf(\"invalid group %#q: %w\", c.Group, err)\n\t\t}\n\t}\n\tfor name, nw := range c.Networks {\n\t\tif err := identifiers.Validate(name); err != nil {\n\t\t\treturn fmt.Errorf(\"invalid network name %#q: %w\", name, err)\n\t\t}\n\t\tif nw.Mode != \"\" {\n\t\t\tif err := identifiers.Validate(nw.Mode); err != nil {\n\t\t\t\treturn fmt.Errorf(\"invalid mode %#q for network %#q: %w\", nw.Mode, name, err)\n\t\t\t}\n\t\t}\n\t\tif nw.Interface != \"\" {\n\t\t\tif err := identifiers.Validate(nw.Interface); err != nil {\n\t\t\t\treturn fmt.Errorf(\"invalid interface %#q for network %#q: %w\", nw.Interface, name, err)\n\t\t\t}\n\t\t}\n\t}\n\n\t// validate all paths.* values\n\tpaths := reflect.ValueOf(&c.Paths).Elem()\n\tpathsMap := make(map[string]string, paths.NumField())\n\tvar socketVMNetNotFound bool\n\tfor i := range paths.NumField() {\n\t\t// extract YAML name from struct tag; strip options like \"omitempty\"\n\t\tname := paths.Type().Field(i).Tag.Get(\"yaml\")\n\t\tif i := strings.IndexRune(name, ','); i > -1 {\n\t\t\tname = name[:i]\n\t\t}\n\t\tpath := paths.Field(i).Interface().(string)\n\t\tpathsMap[name] = path\n\t\t// varPath will be created securely, but any existing parent directories must already be secure\n\t\tif name == \"varRun\" {","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/networks/validate.go#L27-L63","documentation":"A network's `interface` value (used for bridged networks and to derive file/socket names) must be a valid identifier; otherwise networks.Validate wraps identifiers.Validate's error with the interface and network name.","triggerScenarios":"Setting `interface:` in networks.yaml to a value containing whitespace, slashes, or other invalid characters (e.g. a full BSD interface description with spaces) and validating the config.","commonSituations":"macOS bridged setups where users paste 'en0: Wi-Fi' instead of 'en0'; Windows/Linux interface names with spaces; trailing whitespace from copy-paste.","solutions":["Replace the interface value with the bare device identifier (e.g. en0, eth0) with no spaces or extra text.","Remove any trailing/leading whitespace in the YAML value.","Re-run validation after the fix.","If the host interface has a long display name, find its short system name via `networksetup -listallhardwareports` (macOS) or `ip link` (Linux)."],"exampleFix":"# before (networks.yaml)\nnetworks:\n  bridged-en0:\n    mode: bridged\n    interface: \"en0: Wi-Fi\"\n# after\nnetworks:\n  bridged-en0:\n    mode: bridged\n    interface: en0","handlingStrategy":"validation","validationCode":"function validateInterface(iface, name) {\n  if (!iface) return null;\n  if (/\\s/.test(iface) || !/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(iface)) {\n    return `invalid interface '${iface}' for network ${name}: use bare device name (e.g. en0)`;\n  }\n  return null;\n}","typeGuard":"function isValidInterface(iface) {\n  return !iface || (typeof iface === 'string' && /^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(iface));\n}","tryCatchPattern":null,"preventionTips":["Use the short OS device name (en0, eth0), not the display name.","Resolve display names via networksetup -listallhardwareports (macOS) or ip link (Linux).","Trim whitespace after copy-paste.","Bridged configs: only set interface when mode is bridged."],"tags":["config","validation","networks-yaml","bridged"],"backgroundTag":"invalid-identifier","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}