{"record":{"id":"b5d97707cc171c56","repo":"abiosoft/colima","slug":"cannot-make-required-directory-w","errorCode":null,"errorMessage":"cannot make required directory: %w","messagePattern":"cannot make required directory: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"config/files.go","lineNumber":41,"sourceCode":"\tcomputedDir *string\n}\n\n// Dir returns the directory path.\n// It ensures the directory is created on the filesystem by calling\n// `mkdir` prior to returning the directory path.\nfunc (r *requiredDir) Dir() string {\n\tif r.computedDir != nil {\n\t\treturn *r.computedDir\n\t}\n\n\tdir, err := r.dir()\n\tif err != nil {\n\t\tlogrus.Fatal(fmt.Errorf(\"cannot fetch required directory: %w\", err))\n\t}\n\n\tr.once.Do(func() {\n\t\tif err := fsutil.MkdirAll(dir, 0755); err != nil {\n\t\t\tlogrus.Fatal(fmt.Errorf(\"cannot make required directory: %w\", err))\n\t\t}\n\t})\n\n\tr.computedDir = &dir\n\treturn dir\n}\n\nvar (\n\tconfigBaseDir = requiredDir{\n\t\tdir: func() (string, error) {\n\t\t\t// colima home explicit config\n\t\t\tdir := os.Getenv(\"COLIMA_HOME\")\n\t\t\tif _, err := os.Stat(dir); err == nil {\n\t\t\t\treturn dir, nil\n\t\t\t}\n\n\t\t\t// user home directory\n\t\t\thomeDir, err := os.UserHomeDir()","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/config/files.go#L23-L59","documentation":"requiredDir.Dir() creates the resolved directory with fsutil.MkdirAll(dir, 0755) inside a sync.Once; any failure calls logrus.Fatal and the process exits. Typical causes are permission denied on a parent directory, a path component existing as a regular file, a read-only filesystem, or ENOSPC. Like error 93, this cannot be caught by callers.","triggerScenarios":"Any colima command where directory resolution succeeds but mkdir fails: ~/.colima existing as a plain file instead of a directory, COLIMA_HOME/LIMA_HOME pointing under a read-only volume, a parent directory owned by root after sudo misuse, or the disk being full.","commonSituations":"Accidentally creating ~/.colima as a file (e.g. touch ~/.colima); first run on a read-only NFS home; permissions broken by recursive chown or home migration; disk exhaustion during initial provisioning.","solutions":["Inspect the path in the error with ls -ld on the dir and its parents; if a component is a regular file, remove or rename it","Fix ownership and permissions: chown -R $(whoami) on the directory or chmod u+w on the parent","Point COLIMA_HOME (and COLIMA_CACHE_HOME) at a writable location with free space","Free disk space or move the config root off the full volume"],"exampleFix":"# before: ~/.colima is a regular file\nls -l ~/.colima    # -rw-r--r--\ncolima start       # fatal: cannot make required directory\n\n# after\nrm ~/.colima && colima start","handlingStrategy":"validation","validationCode":"// Probe writability before triggering the fatal MkdirAll path.\nif fi, err := os.Stat(dir); err == nil && !fi.IsDir() {\n    return fmt.Errorf(\"%s exists as a file, remove it first\", dir)\n}\nif err := os.MkdirAll(dir, 0755); err != nil {\n    return fmt.Errorf(\"cannot create %s: %w (check permissions and disk space)\", dir, err)\n}","typeGuard":null,"tryCatchPattern":"// Not catchable: MkdirAll failure goes through logrus.Fatal and exits.\n// Pre-flight the directory: stat for file/dir conflicts, verify parent\n// permissions, and confirm free disk space before running colima.","preventionTips":["Never create ~/.colima (or COLIMA_HOME targets) as regular files","Give service accounts write access to the config and cache roots","Monitor disk space; provisioning fails fatally when ENOSPC hits MkdirAll"],"tags":["filesystem","fatal","permissions","mkdir"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}