{"record":{"id":"b604a7f49c86a0e7","repo":"abiosoft/colima","slug":"error-sanitising-mount-path-for-inotify-w","errorCode":null,"errorMessage":"error sanitising mount path for inotify: %w","messagePattern":"error sanitising mount path for inotify: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"daemon/daemon.go","lineNumber":113,"sourceCode":"\n\tif err := l.init(); err != nil {\n\t\treturn fmt.Errorf(\"error preparing daemon directory: %w\", err)\n\t}\n\n\targs := []string{osutil.Executable(), \"daemon\", \"start\", config.CurrentProfile().ShortName}\n\n\tif conf.Network.Address {\n\t\targs = append(args, \"--vmnet\")\n\t\targs = append(args, \"--vmnet-mode\", conf.Network.Mode)\n\t\targs = append(args, \"--vmnet-interface\", conf.Network.BridgeInterface)\n\t}\n\tif conf.MountINotify {\n\t\targs = append(args, \"--inotify\")\n\t\targs = append(args, \"--inotify-runtime\", conf.Runtime)\n\t\tfor _, mount := range conf.MountsOrDefault() {\n\t\t\tp, err := util.CleanPath(mount.Location)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error sanitising mount path for inotify: %w\", err)\n\t\t\t}\n\t\t\targs = append(args, \"--inotify-dir\", p)\n\t\t}\n\t}\n\n\tif cli.Settings.Verbose {\n\t\targs = append(args, \"--very-verbose\")\n\t}\n\n\thost := l.host.WithDir(util.HomeDir())\n\treturn host.RunQuiet(args...)\n}\nfunc (l processManager) Stop(ctx context.Context, conf config.Config) error {\n\tif s, err := l.Running(ctx, conf); err != nil || !s.Running {\n\t\treturn nil\n\t}\n\treturn l.host.RunQuiet(osutil.Executable(), \"daemon\", \"stop\", config.CurrentProfile().ShortName)\n}","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/daemon/daemon.go#L95-L131","documentation":"When MountINotify is enabled, daemon Start appends --inotify-dir for every mount in conf.MountsOrDefault(). Each mount Location passes through util.CleanPath, which expands environment variables, expands a leading ~, then rejects anything not absolute with 'relative paths not supported for mount ...'. This wrapper is returned when any mount location fails that check, aborting daemon start before the inotify process is launched.","triggerScenarios":"a hand-edited colima.yaml with a relative location like \"src\" or \"./project\"; an env-var-based mount whose variable expands to a relative path in the daemon's environment; starting with --mount-inotify while such a mount exists (without inotify the path is never sanitized here).","commonSituations":"configs authored on Linux tools that accept cwd-relative bind paths; templates assuming the shell's cwd; variables like $REPO defined in the interactive shell but absent from the daemon environment.","solutions":["edit the config (`colima start --edit`) and make every mount location absolute (e.g. /Users/me/project)","verify any env vars used in mount locations resolve to absolute paths where colima runs","restart colima after fixing the config"],"exampleFix":"# before (colima.yaml)\nmounts:\n  - location: \"src\"          # relative -> error sanitising mount path for inotify\n\n# after\nmounts:\n  - location: \"/Users/me/project/src\"","handlingStrategy":"validation","validationCode":"for _, m := range conf.MountsOrDefault() {\n    if _, err := util.CleanPath(m.Location); err != nil {\n        return fmt.Errorf(\"mount %q invalid: %w — use an absolute path\", m.Location, err)\n    }\n}\n// cheaper inline check: filepath.IsAbs after expanding $VARS and ~","typeGuard":null,"tryCatchPattern":"if err := manager.Start(ctx, conf); err != nil {\n    var ipErr *util.RelativePathError // if CleanPath ever exports a typed error\n    if errors.As(err, &ipErr) {\n        // point the user at ipErr.Location in their colima.yaml\n    }\n}","preventionTips":["always write absolute paths in colima.yaml mount locations","expand env vars in mounts only for variables guaranteed set in daemon context","lint config in CI: every mounts[].location must start with / or ~"],"tags":["mounts","inotify","configuration","paths"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}