wavetermdev/waveterm · error

error writing fish-integration wave.fish: %v

Error message

error writing fish-integration wave.fish: %v

What it means

InitRcFiles wraps a failure from utilfn.WriteTemplateToFile when rendering wave.fish into the fish-integrations directory. Like the other rc-write errors, the cause is an OS-level write failure or template error; the original error is embedded via %v. Fish blocks will lack the Wave integration script.

Source

Thrown at pkg/util/shellutil/shellutil.go:419

	err = utilfn.WriteTemplateToFile(filepath.Join(zshDir, ".zlogin"), ZshStartup_Zlogin, params)
	if err != nil {
		return fmt.Errorf("error writing zsh-integration .zlogin: %v", err)
	}
	err = utilfn.WriteTemplateToFile(filepath.Join(zshDir, ".zshenv"), ZshStartup_Zshenv, params)
	if err != nil {
		return fmt.Errorf("error writing zsh-integration .zshenv: %v", err)
	}
	err = utilfn.WriteTemplateToFile(filepath.Join(bashDir, ".bashrc"), BashStartup_Bashrc, params)
	if err != nil {
		return fmt.Errorf("error writing bash-integration .bashrc: %v", err)
	}
	err = os.WriteFile(filepath.Join(bashDir, "bash_preexec.sh"), []byte(BashStartup_Preexec), 0644)
	if err != nil {
		return fmt.Errorf("error writing bash-integration bash_preexec.sh: %v", err)
	}
	err = utilfn.WriteTemplateToFile(filepath.Join(fishDir, "wave.fish"), FishStartup_Wavefish, params)
	if err != nil {
		return fmt.Errorf("error writing fish-integration wave.fish: %v", err)
	}
	err = utilfn.WriteTemplateToFile(filepath.Join(pwshDir, "wavepwsh.ps1"), PwshStartup_wavepwsh, params)
	if err != nil {
		return fmt.Errorf("error writing pwsh-integration wavepwsh.ps1: %v", err)
	}

	return nil
}

func initCustomShellStartupFilesInternal() error {
	log.Printf("initializing wsh and shell startup files\n")
	waveDataHome := wavebase.GetWaveDataDir()
	binDir := filepath.Join(waveDataHome, WaveHomeBinDir)
	err := InitRcFiles(waveDataHome, binDir)
	if err != nil {
		return err
	}

View on GitHub (pinned to a4447c1563)

Solutions

  1. Make the fish-integrations directory writable by the current user (chown/chmod).
  2. Delete the fish-integrations dir and rerun initialization so Wave recreates it.
  3. Verify free disk space and that the volume is mounted read-write.
  4. Examine the wrapped error for the precise OS-level cause.
Defensive patterns

Strategy: validation

Validate before calling

// verify fish-integrations dir exists and is writable
if fi, err := os.Stat(fishDir); err != nil || !fi.IsDir() {
	if err := os.MkdirAll(fishDir, 0755); err != nil { return err }
}
probe := filepath.Join(fishDir, ".probe")
if err := os.WriteFile(probe, nil, 0644); err != nil { return err }
os.Remove(probe)

Try / catch

err := shellutil.InitRcFiles(home, binDir)
if err != nil && strings.Contains(err.Error(), "fish-integration wave.fish") {
	log.Printf("fish rc write failed: %v — resetting dir", err)
	os.RemoveAll(fishDir)
	return shellutil.InitRcFiles(home, binDir)
}

Prevention

When it happens

Trigger: InitRcFiles / InstallRcFiles reaching the wave.fish write step while <fishDir> is unwritable, missing, or the template params cannot render (e.g. quoting issue in WSHBINDIR).

Common situations: Fish integration dir removed by cleanup scripts; read-only container layers; permission drift when multiple user accounts run Wave against a shared home.

Understand the failure class

Background: "Permission denied" / "Failed to write" file errors: why a library can't write its files to disk (EACCES, EPERM, ENOSPC) and how to fix them — this error's family across 43 libraries.

Related errors


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/e0ed6dfdc471f13d. Report an issue: GitHub.