plandex-ai/plandex · error

error marshalling auth: %v

Error message

error marshalling auth: %v

What it means

Fires in writeCurrentAuth when json.Marshal fails on the Current auth session struct before writing fs.HomeAuthPath. Unexpected since the auth struct is plain data; usually means a bad custom marshaller or corrupted in-memory session.

Source

Thrown at app/cli/auth/state.go:97

	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)

	if err != nil {
		return fmt.Errorf("error marshalling auth: %v", err)
	}

	err = os.WriteFile(fs.HomeAuthPath, bytes, os.ModePerm)

	if err != nil {
		return fmt.Errorf("error writing auth: %v", err)
	}

	return nil
}

View on GitHub (pinned to e2d772072e)

Solutions

  1. Check the wrapped error for the offending field
  2. Review custom MarshalJSON methods on the auth/session types
  3. Re-initialize or reload auth state if it is corrupted in memory
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at app/cli/auth/state.go:97 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/f5319718bf97d025. Report an issue: GitHub.