{"record":{"id":"baf2f4c8367c4988","repo":"abiosoft/colima","slug":"error-persisting-colima-state-w","errorCode":null,"errorMessage":"error persisting Colima state: %w","messagePattern":"error persisting Colima state: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"environment/vm/lima/lima.go","lineNumber":352,"sourceCode":"\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t})\n\n\t// replicate addresses when network address is disabled\n\ta.Add(func() error {\n\t\tif err := l.replicateHostAddresses(conf); err != nil {\n\t\t\tlogrus.Warnln(fmt.Errorf(\"unable to assign host IP addresses to the VM: %w\", err))\n\t\t}\n\t\treturn nil\n\t})\n\n\t// preserve state\n\ta.Add(func() error {\n\t\tif err := configmanager.SaveToFile(conf, config.CurrentProfile().StateFile()); err != nil {\n\t\t\tlogrus.Warnln(fmt.Errorf(\"error persisting Colima state: %w\", err))\n\t\t}\n\t\treturn nil\n\t})\n\n\t// save store settings\n\ta.Add(func() error {\n\t\tif len(l.limaConf.AdditionalDisks) == 0 {\n\t\t\treturn nil\n\t\t}\n\n\t\t// startup is successful\n\t\t// if additional disk is present, then it must've been formatted correctly.\n\t\tif err := store.Set(func(s *store.Store) {\n\t\t\ts.DiskFormatted = true\n\t\t}); err != nil {\n\t\t\t// not fatal, but should be logged\n\t\t\tlogrus.Warnln(fmt.Errorf(\"error persisting store settings: %w\", err))\n\t\t}","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/environment/vm/lima/lima.go#L334-L370","documentation":"Warning logged when configmanager.SaveToFile cannot persist the resolved VM configuration to the current profile's state file (config.CurrentProfile().StateFile()) during the post-start actions. The start itself already succeeded; only the on-disk state snapshot is lost, so colima logs and continues.","triggerScenarios":"configmanager.SaveToFile fails: no space left on the host filesystem holding ~/.colima/<profile>/*.state, permission/ownership problems in the profile directory, or two colima processes writing the same profile concurrently.","commonSituations":"Full disk on macOS home volume; ~/.colima owned by root after running with sudo once; running 'colima start' from two terminals against the same profile; antivirus/backup tool holding the state file open.","solutions":["Check free space with 'df -h ~' and free space if needed","Fix ownership of the profile directory: sudo chown -R $(whoami) ~/.colima","Ensure only one colima process touches the profile: 'colima list' then stop duplicates","Re-run 'colima start' after fixing; the state file is rewritten on each successful start"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure the state file's directory is writable before starting\nfunc stateDirWritable(p config.Profile) error {\n    dir := filepath.Dir(p.StateFile())\n    if info, err := os.Stat(dir); err != nil || !info.IsDir() {\n        return fmt.Errorf(\"state dir unavailable: %w\", err)\n    }\n    probe := filepath.Join(dir, \".write-probe\")\n    return os.WriteFile(probe, nil, 0600)\n}","typeGuard":null,"tryCatchPattern":"In Go: wrap the start call and inspect the warning path indirectly — colima already downgrades this to a log. Callers should check errors.Is(err, fs.ErrPermission) / fs.ErrNoSpace only if surfacing the log, and continue since startup already succeeded.","preventionTips":["Keep the home volume from running full; the state file is small but writes fail on ENOSPC","Never run colima under sudo (leaves root-owned files) — fix with chown if already done","One colima process per profile at a time"],"tags":["persistence","state","filesystem","startup"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}