{"record":{"id":"74ef7ee3d4cce140","repo":"lima-vm/lima","slug":"invalid-fstab-entry-expected-6-fields-got-d-v","errorCode":null,"errorMessage":"invalid fstab entry: expected 6 fields, got %d: %v","messagePattern":"invalid fstab entry: expected 6 fields, got (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/guestagent/fakecloudinit/fakecloudinit_darwin.go","lineNumber":148,"sourceCode":"\t\tif err = setResolvConf(ctx, userData.ResolvConf); err != nil {\n\t\t\terrs = append(errs, fmt.Errorf(\"failed to apply DNS configuration: %w\", err))\n\t\t}\n\t}\n\tif userData.CACerts != nil {\n\t\tlogrus.Warn(\"ca_certs is not implemented\")\n\t}\n\tif len(userData.BootCmd) > 0 {\n\t\tlogrus.Warn(\"bootcmd is not implemented\")\n\t}\n\treturn errors.Join(errs...)\n}\n\n// mountFSTabEntry mounts a filesystem based on the given fstab entry.\n// The format mimics Linux's convention.\n// 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","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/guestagent/fakecloudinit/fakecloudinit_darwin.go#L130-L166","documentation":"Raised by mountFSTabEntry when a mounts entry parsed from the user-data does not contain exactly 6 whitespace-separated fields, mimicking the Linux fstab format (fs_spec, fs_file, fs_vfstype, fs_mntops, fs_dump, fs_passno). The actual field count and entry are printed in the message.","triggerScenarios":"A `mounts:` list item in user-data splits into != 6 fields, e.g. `[\"/src\", \"/dst\", \"virtiofs\", \"ro\"]` (4 fields) or a malformed YAML string where quoting collapsed fields.","commonSituations":"Copying only the first 3 columns from a Linux /etc/fstab, omitting the dump and passno columns, or YAML indentation/quoting mistakes that merge or split tokens.","solutions":["Count the fields in the failing entry shown in the error message; it must be exactly 6.","Append the two trailing fstab columns (`0 0`) if you only wrote src/dst/fstype/options.","Use the list form in YAML to avoid quoting/whitespace ambiguity: [\"/src\", \"/dst\", \"virtiofs\", \"ro\", \"0\", \"0\"].","Re-run after fixing; this is a pure validation error, no state is changed."],"exampleFix":"// before (user-data)\nmounts:\n  - [\"/Users/foo/share\", \"/mnt/share\", \"virtiofs\", \"ro\"]\n// after\nmounts:\n  - [\"/Users/foo/share\", \"/mnt/share\", \"virtiofs\", \"ro\", \"0\", \"0\"]","handlingStrategy":"validation","validationCode":"func validateFSTabFieldCount(mounts [][]string) error {\n  for i, m := range mounts {\n    if len(m) != 6 {\n      return fmt.Errorf(\"mounts[%d]: expected 6 fields (src dst fstype opts dump passno), got %d: %v\", i, len(m), m)\n    }\n  }\n  return nil\n}","typeGuard":"func hasSixFields(m []string) bool { return len(m) == 6 }","tryCatchPattern":"if err := mountFSTabEntry(m); err != nil {\n  if strings.Contains(err.Error(), \"invalid fstab entry\") {\n    log.Warnf(\"skipping malformed mounts entry %v\", m)\n    continue\n  }\n  return err\n}","preventionTips":["Always include the dump and passno columns (`0 0`) even though they are unused.","Prefer YAML list syntax over free-form strings to control tokenization.","Count fields against the Linux fstab convention: src, dst, fstype, opts, dump, passno.","Dry-run your user-data through a schema check before baking cidata.iso."],"tags":["cloud-init","fstab","validation","mount"],"backgroundTag":"invalid-fstab-entry","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}