abiosoft/colima · error
empty file, template edit aborted
Error message
empty file, template edit aborted
What it means
Returned by `colima template` when the editor buffer is saved containing only whitespace: waitForUserEdit returns the empty-name abort convention and the command converts it into this error, exiting non-zero. Clearing the file is the designed abort gesture for template editing.
Source
Thrown at cmd/template.go:49
abort, err := embedded.ReadString("defaults/abort.yaml")
if err != nil {
return fmt.Errorf("error reading embedded file: %w", err)
}
info, err := embedded.ReadString("defaults/template.yaml")
if err != nil {
return fmt.Errorf("error reading embedded file: %w", err)
}
template, err := templateFileOrDefault()
if err != nil {
return fmt.Errorf("error reading template file: %w", err)
}
tmpFile, err := waitForUserEdit(templateCmdArgs.Editor, []byte(abort+"\n"+info+"\n"+template))
if err != nil {
return fmt.Errorf("error editing template file: %w", err)
}
if tmpFile == "" {
return fmt.Errorf("empty file, template edit aborted")
}
defer func() {
_ = os.Remove(tmpFile)
}()
// load and resave template to ensure the format is correct
cf, err := configmanager.LoadFrom(tmpFile)
if err != nil {
return fmt.Errorf("error in template: %w", err)
}
if err := configmanager.SaveToFile(cf, templateFile()); err != nil {
return fmt.Errorf("error saving template: %w", err)
}
log.Println("configurations template saved")
return nil
},View on GitHub (pinned to c3a5f9184d)
Solutions
- Treat this as a clean abort if that was the intent — the template file on disk is untouched
- Re-run `colima template` and save with content (or quit without deleting everything) to keep or change the template
- Non-interactively reset the template by deleting the file at `colima template --print`'s path; colima then falls back to the embedded default
Defensive patterns
Strategy: try-catch
Try / catch
err := templateCmd.Execute()
if err != nil && err.Error() == "empty file, template edit aborted" {
// deliberate abort; the persisted template is unchanged
err = nil
} Prevention
- Expect a non-zero exit when clearing the buffer to cancel
- Quit the editor without emptying the file to accept the template unchanged
When it happens
Trigger: During `colima template`, deleting all buffer content and saving before closing; automation that truncates the temp file.
Common situations: Users intending to cancel the template edit; accidental select-all deletion; scripts expecting exit code 0.
Related errors
- empty file, startup aborted
- error editing template file: %w
- error applying nerdctl script template: %w
- unable to read embedded file: %w
- error editing config file: %w
AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15).
Data as JSON: /api/errors/2399fb77a2482e40.
Report an issue: GitHub.