abiosoft/colima · warning

error running %s provision script(s)

Error message

error running %s provision script(s)

What it means

runProvisionScripts executes user-defined provision scripts (the config `provision` list) inside the guest via `sh -c` for a given mode (start/after-boot/ready); if any fail, this aggregated warning is printed once. Note a formatting defect: the mode argument is never passed to fmt.Errorf, so it renders as `error running %!s(MISSING) provision script(s)`. Non-fatal by design: start continues.

Source

Thrown at app/app.go:175

	if err := generateSSHConfig(conf.SSHConfig); err != nil {
		log.Trace("error generating ssh_config: %w", err)
	}
	return nil
}

func (c colimaApp) runProvisionScripts(conf config.Config, mode string) {
	var failed bool
	for _, s := range conf.Provision {
		if s.Mode != mode {
			continue
		}
		if err := c.guest.Run("sh", "-c", s.Script); err != nil {
			failed = true
		}
	}
	if failed {
		log.Warnln(fmt.Errorf("error running %s provision script(s)", mode))
	}
}

func (c colimaApp) Stop(force bool) error {
	ctx := context.Background()
	log.Println("stopping", config.CurrentProfile().DisplayName)

	// the order for stop is:
	//   container stop -> vm stop

	// stop container runtimes only if the guest is responsive
	if c.guest.Running(ctx) && c.guestResponsive() {
		containers, err := c.currentContainerEnvironments(ctx)
		if err != nil {
			log.Warnln(fmt.Errorf("error retrieving runtimes: %w", err))
		}

		// stop happens in reverse of start

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Run the script manually to see the real error: `colima ssh -- sh -c '<script>'`
  2. Check the mode: scripts needing docker/kubernetes must use a mode that runs after the runtime is up (e.g. ready), not start/after-boot
  3. Validate the YAML quoting of the provision entry so the script string arrives intact
  4. Test with `colima start --verbose` and watch guest output before enabling the script permanently

Example fix

# before (script fails: references docker before runtime is up)
provision:
- mode: afterBoot
  script: docker load -i /tmp/images.tar

# after
provision:
- mode: ready
  script: docker load -i /tmp/images.tar
Defensive patterns

Strategy: validation

Validate before calling

// dry-run each provision script for syntax before starting
for _, s := range conf.Provision {
    if err := exec.Command("sh", "-n", s.Script).Run(); err != nil {
        return fmt.Errorf("provision script (mode %s) has a syntax error: %w", s.Mode, err)
    }
}

Try / catch

// warnings are not surfaced as errors; after start, manually replay each script to confirm:
// colima ssh -- sh -c '<script>'

Prevention

When it happens

Trigger: A provision script from `colima start --provision` or config.yaml exits non-zero in the guest: bad syntax, commands missing from the appliance image, missing mounts, or a script assuming a runtime that is not up yet (wrong mode).

Common situations: Script written for docker runs in after-boot mode before docker exists; script references $HOME paths absent for the script user; copy-pasted YAML with broken quoting so `sh -c` receives garbage.

Related errors


AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15). Data as JSON: /api/errors/600fb52eae087042. Report an issue: GitHub.