wavetermdev/waveterm · error
error writing zsh-integration .zprofile: %v
Error message
error writing zsh-integration .zprofile: %v
What it means
InitRcFiles renders the zsh integration template ZshStartup_Zprofile and writes it to <dir>/.zprofile via WriteTemplateToFile; any write/template failure is wrapped in this error. Without .zprofile the zsh integration scripts are incomplete and shell integration will not fully activate.
Source
Thrown at pkg/util/shellutil/shellutil.go:395
return err
}
var pathSep string
if runtime.GOOS == "windows" {
pathSep = ";"
} else {
pathSep = ":"
}
params := map[string]string{
"WSHBINDIR": HardQuote(absWshBinDir),
"WSHBINDIR_PWSH": HardQuotePowerShell(absWshBinDir),
"PATHSEP": pathSep,
}
// write files to directory
err = utilfn.WriteTemplateToFile(filepath.Join(zshDir, ".zprofile"), ZshStartup_Zprofile, params)
if err != nil {
return fmt.Errorf("error writing zsh-integration .zprofile: %v", err)
}
err = utilfn.WriteTemplateToFile(filepath.Join(zshDir, ".zshrc"), ZshStartup_Zshrc, params)
if err != nil {
return fmt.Errorf("error writing zsh-integration .zshrc: %v", err)
}
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)View on GitHub (pinned to a4447c1563)
Solutions
- Ensure the target zsh integration directory exists and is writable by the current user (mkdir -p, chown)
- Check disk space and quota on the volume holding the directory
- Look at the wrapped %v error to distinguish permission vs template failures
- Run as the correct user — files written by root into a user HOME cause later EACCES
Example fix
// before
err := shellutil.InitRcFiles(zshDir)
// after
if err := os.MkdirAll(zshDir, 0o700); err != nil {
return err
}
if err := shellutil.InitRcFiles(zshDir); err != nil {
return fmt.Errorf("rc file install failed (check perms/space on %s): %w", zshDir, err)
} Defensive patterns
Strategy: validation
Validate before calling
if err := os.MkdirAll(zshDir, 0o700); err != nil {
return err
}
if fi, err := os.Stat(zshDir); err != nil || !fi.IsDir() {
return fmt.Errorf("zsh dir %s not writable", zshDir)
}
err := shellutil.InitRcFiles(zshDir) Try / catch
if err := shellutil.InitRcFiles(zshDir); err != nil {
if strings.Contains(err.Error(), ".zprofile") {
var pe *os.PathError
if errors.As(err, &pe) {
log.Printf("write failed on %s: %v", pe.Path, pe.Err)
}
}
return err
} Prevention
- Create the integration directory with correct perms before installing rc files
- Ensure the process runs as the user who owns HOME
- Check disk space/quota before writing rc files
- Unwrap the wrapped error to distinguish EACCES vs ENOSPC vs template errors
When it happens
Trigger: InitRcFiles failing to write .zprofile — directory doesn't exist or is not writable, disk full, read-only filesystem, permissions denied on the target path, or template execution error in ZshStartup_Zprofile params.
Common situations: Installing rc files into a HOME with restrictive permissions; read-only container images; ~/.zshdir path created with wrong ownership after running as different users; NFS-mounted homes with quota exceeded.
Related errors
- error writing zsh-integration .zshrc: %v
- error writing zsh-integration .zlogin: %v
- error writing zsh-integration .zshenv: %v
- error writing bash-integration .bashrc: %v
- error writing bash-integration bash_preexec.sh: %v
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/bb2ba19241da125e.
Report an issue: GitHub.