plandex-ai/plandex · error
error marshalling accounts: %v
Error message
error marshalling accounts: %v
What it means
Fires in storeAccount when json.Marshal fails to serialize the in-memory accounts slice to JSON before it is persisted to fs.HomeAccountsPath. Marshal of []Account should not fail under normal data, so this signals corrupted account structs (e.g. unsupported types via custom MarshalJSON).
Source
Thrown at app/cli/auth/state.go:77
}
found := false
for i, account := range accounts {
if account.UserId == toStore.UserId {
accounts[i] = toStore
found = true
break
}
}
if !found {
accounts = append(accounts, toStore)
}
bytes, err := json.Marshal(accounts)
if err != nil {
return fmt.Errorf("error marshalling accounts: %v", err)
}
err = os.WriteFile(fs.HomeAccountsPath, bytes, os.ModePerm)
if err != nil {
return fmt.Errorf("error writing accounts: %v", err)
}
return nil
}
func writeCurrentAuth() error {
if Current == nil {
return fmt.Errorf("error writing auth: auth not loaded")
}
bytes, err := json.Marshal(Current)
View on GitHub (pinned to e2d772072e)
Solutions
- Inspect the wrapped marshal error to find the offending account field type
- Fix any custom MarshalJSON implementations on the Account type
- Verify no unmarshalable values (channels, funcs, cycles) enter the accounts slice
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at app/cli/auth/state.go:77 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/7b7aa8d4fb6ce402.
Report an issue: GitHub.