{"record":{"id":"1e47343952af9eb2","repo":"wavetermdev/waveterm","slug":"error-writing-bash-integration-bashrc-v","errorCode":null,"errorMessage":"error writing bash-integration .bashrc: %v","messagePattern":"error writing bash-integration \\.bashrc: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/util/shellutil/shellutil.go","lineNumber":411,"sourceCode":"\terr = utilfn.WriteTemplateToFile(filepath.Join(zshDir, \".zprofile\"), ZshStartup_Zprofile, params)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error writing zsh-integration .zprofile: %v\", err)\n\t}\n\terr = utilfn.WriteTemplateToFile(filepath.Join(zshDir, \".zshrc\"), ZshStartup_Zshrc, params)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error writing zsh-integration .zshrc: %v\", err)\n\t}\n\terr = utilfn.WriteTemplateToFile(filepath.Join(zshDir, \".zlogin\"), ZshStartup_Zlogin, params)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error writing zsh-integration .zlogin: %v\", err)\n\t}\n\terr = utilfn.WriteTemplateToFile(filepath.Join(zshDir, \".zshenv\"), ZshStartup_Zshenv, params)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error writing zsh-integration .zshenv: %v\", err)\n\t}\n\terr = utilfn.WriteTemplateToFile(filepath.Join(bashDir, \".bashrc\"), BashStartup_Bashrc, params)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error writing bash-integration .bashrc: %v\", err)\n\t}\n\terr = os.WriteFile(filepath.Join(bashDir, \"bash_preexec.sh\"), []byte(BashStartup_Preexec), 0644)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error writing bash-integration bash_preexec.sh: %v\", err)\n\t}\n\terr = utilfn.WriteTemplateToFile(filepath.Join(fishDir, \"wave.fish\"), FishStartup_Wavefish, params)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error writing fish-integration wave.fish: %v\", err)\n\t}\n\terr = utilfn.WriteTemplateToFile(filepath.Join(pwshDir, \"wavepwsh.ps1\"), PwshStartup_wavepwsh, params)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error writing pwsh-integration wavepwsh.ps1: %v\", err)\n\t}\n\n\treturn nil\n}\n\nfunc initCustomShellStartupFilesInternal() error {","sourceCodeStart":393,"sourceCodeEnd":429,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/util/shellutil/shellutil.go#L393-L429","documentation":"InitRcFiles wraps the failure of writing the templated .bashrc into Wave's bash-integrations directory. This is an OS-level write or template-render failure from utilfn.WriteTemplateToFile, surfaced verbatim after the %v. Bash blocks lose their integration script if this fails.","triggerScenarios":"InitRcFiles (or InstallRcFiles) reaching the .bashrc write step where <bashDir>/.bashrc cannot be opened for writing: permissions, missing dir, disk full, or template execution error.","commonSituations":"Corporate-managed machines where the wave data dir is locked down; NFS/ro-mounted home dirs; interrupted first-run leaving partial dirs with wrong ownership.","solutions":["Ensure the wave data dir and bash-integrations subdir are writable by the running user (chown/chmod).","Recreate the bash-integrations directory (rm -rf then rerun) if it is in a bad state.","Check disk space and filesystem writability on the target volume.","Read the wrapped error text to pinpoint the underlying OS failure."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// verify bash-integrations dir is writable before InitRcFiles\nif err := os.MkdirAll(bashDir, 0755); err != nil { return err }\nif !writable(bashDir) { // e.g. open probe file O_RDWR\n\treturn fmt.Errorf(\"bash-integrations dir not writable: %s\", bashDir)\n}","typeGuard":null,"tryCatchPattern":"err := shellutil.InitRcFiles(home, binDir)\nif err != nil && strings.Contains(err.Error(), \"bash-integration .bashrc\") {\n\tos.RemoveAll(bashDir)\n\tif retryErr := shellutil.InitRcFiles(home, binDir); retryErr != nil {\n\t\treturn retryErr\n\t}\n}","preventionTips":["Run Wave under one consistent user account per data dir.","Repair partial first-run states by wiping the bash-integrations directory.","Check for corporate endpoint protection policies blocking writes to dotfile dirs.","Verify the volume is not mounted read-only (common in containers/snapshots)."],"tags":["filesystem","shell-integration","bash","file-write"],"backgroundTag":"file-write-permission-denied","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}