{"record":{"id":"04133b3c39002e0a","repo":"lima-vm/lima","slug":"invalid-pseudo-tag-for-virtiofs-q","errorCode":null,"errorMessage":"invalid pseudo tag for virtiofs: %#q","messagePattern":"invalid pseudo tag for virtiofs: %#q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/guestagent/fakecloudinit/fakecloudinit_darwin.go","lineNumber":163,"sourceCode":"// The entries are not written to /etc/fstab.\nfunc mountFSTabEntry(m []string) error {\n\tif len(m) != 6 {\n\t\treturn fmt.Errorf(\"invalid fstab entry: expected 6 fields, got %d: %v\", len(m), m)\n\t}\n\tsrc, dst, fsType := m[0], m[1], m[2]\n\tswitch fsType {\n\tcase \"virtiofs\":\n\t\treturn mountVirtiofs(src, dst)\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported filesystem type %#q for fstab entry: %v\", fsType, m)\n\t}\n}\n\n// mountVirtiofs symlinks `/Volumes/My Shared Files/<pseudoTag>` (automatically mounted by macOS) to dir.\n// dir must not exist, or, must be a symlink to the expected source.\nfunc mountVirtiofs(pseudoTag, dir string) error {\n\tif strings.Contains(pseudoTag, string(filepath.Separator)) {\n\t\treturn fmt.Errorf(\"invalid pseudo tag for virtiofs: %#q\", pseudoTag)\n\t}\n\tlnSrc := filepath.Join(\"/Volumes/My Shared Files\", pseudoTag)\n\n\t// FIXME: verify that the filesystem of lnSrc is indeed read-only when user-data contains the \"ro\" option.\n\t// unix.Statfs() could be used, but unix.Statfs_t.Flags & unix.MNT_RDONLY seems always 0 for virtiofs.\n\t// `mount -v` does not show \"ro\" flag either.\n\n\tlnExisting, err := os.Readlink(dir)\n\tif err == nil {\n\t\tif lnExisting == lnSrc {\n\t\t\treturn nil // already symlinked\n\t\t}\n\t\treturn fmt.Errorf(\"unexpected symlink target for virtiofs mount source %#q: expected %#q, got %#q\", lnSrc, lnSrc, lnExisting)\n\t}\n\tif !errors.Is(err, os.ErrNotExist) {\n\t\tlogrus.WithError(err).Warnf(\"Failed to read existing symlink for virtiofs mount source %#q\", lnSrc)\n\t}\n\tif err := os.Symlink(lnSrc, dir); err != nil {","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/guestagent/fakecloudinit/fakecloudinit_darwin.go#L145-L181","documentation":"Raised by mountVirtiofs when the virtiofs mount source (pseudo tag) contains a path separator. The pseudo tag is used verbatim as the last component of /Volumes/My Shared Files/<pseudoTag>, so it must be a plain name, not a path. The offending tag is printed in the message.","triggerScenarios":"A mounts entry whose first field (src) contains a `/` (e.g. `/Users/foo/share` or `share/sub`), which would otherwise try to join outside the fixed /Volumes/My Shared Files directory.","commonSituations":"Mistaking the fstab src field for a host path; on macOS the value must be the macOS-automounted share name (the pseudo tag shown by Lima, e.g. the mount tag), not a filesystem path.","solutions":["Replace the src field with the bare pseudo tag (single path component, no slashes) of the shared directory.","Look up the correct tag: it is the name of the directory macOS auto-mounts under /Volumes/My Shared Files (e.g. via Lima's mount tags).","If you need a subdirectory, create a symlink inside the guest pointing at the desired path rather than encoding it in the pseudo tag.","Verify the share is actually configured in the Lima YAML mounts so /Volumes/My Shared Files/<tag> exists."],"exampleFix":"// before (user-data)\nmounts:\n  - [\"/Users/foo/share\", \"/mnt/share\", \"virtiofs\", \"ro\", \"0\", \"0\"]\n// after\nmounts:\n  - [\"share\", \"/mnt/share\", \"virtiofs\", \"ro\", \"0\", \"0\"]","handlingStrategy":"validation","validationCode":"func validatePseudoTag(src string) error {\n  if src == \"\" { return errors.New(\"pseudo tag is empty\") }\n  if strings.ContainsAny(src, \"/\\\\\") { return fmt.Errorf(\"pseudo tag %q must be a single path component\", src) }\n  return nil\n}","typeGuard":"func isSinglePathComponent(s string) bool { return s != \"\" && !strings.Contains(s, string(filepath.Separator)) }","tryCatchPattern":"if err := mountFSTabEntry(m); err != nil {\n  if strings.Contains(err.Error(), \"invalid pseudo tag\") {\n    log.Warnf(\"fix mounts src %q to a bare share tag\", m[0])\n    continue\n  }\n  return err\n}","preventionTips":["The src field is a share tag, not a host or guest filesystem path.","Never include `/` or `\\` in the pseudo tag.","Confirm the tagged share exists under /Volumes/My Shared Files in the guest.","Create in-guest symlinks for subdirectory targets instead of encoding paths in the tag."],"tags":["macos","cloud-init","virtiofs","validation","path"],"backgroundTag":"invalid-mount-source","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}