{"record":{"id":"aa28f215c9b8fc32","repo":"abiosoft/colima","slug":"error-preparing-daemon-directory-w","errorCode":null,"errorMessage":"error preparing daemon directory: %w","messagePattern":"error preparing daemon directory: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"daemon/daemon.go","lineNumber":97,"sourceCode":"\n\tctx = context.WithValue(ctx, process.CtxKeyDaemon(), s.Running)\n\n\tfor _, p := range processesFromConfig(conf) {\n\t\tpErr := p.Alive(ctx)\n\t\ts.Processes = append(s.Processes, processStatus{\n\t\t\tName:    p.Name(),\n\t\t\tRunning: pErr == nil,\n\t\t\tError:   pErr,\n\t\t})\n\t}\n\treturn\n}\n\nfunc (l processManager) Start(ctx context.Context, conf config.Config) error {\n\t_ = l.Stop(ctx, conf) // this is safe, nothing is done when not running\n\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)","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/daemon/daemon.go#L79-L115","documentation":"Manager.Start (the entry the CLI uses when a rootful daemon is needed) first best-effort-stops a previous daemon, then calls init(). This is the outer wrapper around that init failure — the underlying cause is the MkdirAll of <profile ConfigDir>/daemon failing exactly as in the 'error preparing vmnet' case; you see this message when it surfaces from daemon Start.","triggerScenarios":"`colima start` with --network-address (vmnet) or --mount-inotify enabled triggers daemon Start; the MkdirAll of ~/.colima/<profile>/daemon fails due to root-owned path segments, unwritable COLIMA_HOME, or full disk.","commonSituations":"first start after ever running colima with sudo; profile directories created by root; CI runners with read-only home or tiny disk quotas.","solutions":["run `colima start --very-verbose` and read the wrapped cause below 'error preparing daemon directory'","fix ownership of the profile config dir: sudo chown -R $(whoami) ~/.colima","ensure COLIMA_HOME is set to a writable directory and exported to the colima process","free disk space or repair permissions on the parent directory"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-flight the exact directory Start will create\ndir := filepath.Join(config.CurrentProfile().ConfigDir(), \"daemon\")\nif fi, err := os.Stat(filepath.Dir(dir)); err == nil && !fi.IsDir() {\n    return fmt.Errorf(\"%s exists but is not a directory — remove it first\", filepath.Dir(dir))\n}\nif err := fsutil.MkdirAll(dir, 0755); err != nil {\n    return err // surface errno before invoking daemon Start\n}","typeGuard":null,"tryCatchPattern":"if err := daemon.Start(ctx, conf); err != nil {\n    if strings.HasPrefix(err.Error(), \"error preparing daemon directory\") {\n        cause := errors.Unwrap(err) // *fs.PathError from MkdirAll\n        // act on cause: chown for EACCES, cleanup for ENOSPC/EROFS\n    }\n}","preventionTips":["fix ownership of ~/.colima after any accidental sudo usage","validate COLIMA_HOME/HOME writability in automation before `colima start`","run `colima start --very-verbose` when daemon issues appear to see the wrapped errno"],"tags":["daemon","startup","filesystem","permissions"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}