plandex-ai/plandex · error
error writing current plan settings: %v
Error message
error writing current plan settings: %v
What it means
This is the final write step of WriteCurrentBranch: os.WriteFile(path, bytes, 0644) persists settings-v2.json. If the write fails — permissions, disk full, read-only filesystem, path is a directory — the OS error is wrapped as 'error writing current plan settings: %v'. Note the in-memory CurrentBranch global is only updated after this succeeds, so a failure leaves branch state unchanged.
Source
Thrown at app/cli/lib/plans.go:156
existingSettings := (*settingsByAccount)[auth.Current.UserId]
if existingSettings == nil {
existingSettings = &types.PlanSettings{}
}
existingSettings.Branch = branch
(*settingsByAccount)[auth.Current.UserId] = existingSettings
bytes, err = json.Marshal(settingsByAccount)
if err != nil {
return fmt.Errorf("error marshalling current plan settings: %v", err)
}
err = os.WriteFile(path, bytes, 0644)
if err != nil {
return fmt.Errorf("error writing current plan settings: %v", err)
}
CurrentBranch = branch
return nil
}
func GetCurrentBranchNamesByPlanId(planIds []string) (map[string]string, error) {
if fs.HomePlandexDir == "" {
return nil, fmt.Errorf("HomePlandexDir not set")
}
if CurrentProjectId == "" || HomeCurrentPlanPath == "" {
return nil, fmt.Errorf("no current project")
}
var mu sync.Mutex
branches := make(map[string]string)View on GitHub (pinned to e2d772072e)
Solutions
- Read the wrapped OS error and address it: free disk space, fix permissions (chown/chmod), or remove a conflicting directory.
- Verify ~/.plandex is writable by the current user: touch ~/.plandex/<project>/<plan>/settings-v2.json.test
- If on a network mount, reconnect/remount read-write, then rerun the checkout/branch command.
Example fix
// error: ... no space left on device $ df -h ~ $ rm -rf ~/tmp-cleanup # free space $ plandex checkout main
Defensive patterns
Strategy: try-catch
Validate before calling
dir := filepath.Join(fs.HomePlandexDir, lib.CurrentProjectId, lib.CurrentPlanId)
if err := os.WriteFile(filepath.Join(dir, ".write-test"), []byte("ok"), 0644); err != nil {
return fmt.Errorf("~/.plandex not writable: %w", err)
}
os.Remove(filepath.Join(dir, ".write-test")) Try / catch
if err := lib.WriteCurrentBranch(branch); err != nil {
var pe *os.PathError
if errors.As(err, &pe) && errors.Is(pe.Err, syscall.ENOSPC) {
return fmt.Errorf("disk full: free space and retry")
}
if errors.Is(err, os.ErrPermission) {
return fmt.Errorf("run: chown -R $USER ~/.plandex")
}
return err
} Prevention
- Monitor disk quota/space on the home filesystem.
- Never run the CLI with sudo; fix ownership afterwards with chown if you did.
- On NFS/network homes, confirm the mount is read-write before branch operations.
When it happens
Trigger: os.WriteFile fails on ~/.plandex/<projectId>/<planId>/settings-v2.json: permission denied, read-only mount, no space left on device, or a directory exists at that exact path.
Common situations: Home dir quota exceeded or disk full; ~/.plandex ownership changed by running the CLI with sudo; a directory mistakenly created at settings-v2.json; network home dirs (NFS) gone read-only after a disconnect.
Related errors
- error walking directory: %s
- failed to check if %s exists: %s
- failed to read %s: %s
- failed to write %s: %s
- failed to remove %s: %s
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/bea9860cad47696c.
Report an issue: GitHub.