plandex-ai/plandex · error

Error marshalling response:

Error message

Error marshalling response: 

What it means

ListOrgsHandler: json.Marshal of the API org list fails before writing the response, producing a 500. Marshalling plain org structs should not fail; points to a bad custom marshaller or unexpected field type.

Source

Thrown at app/server/handlers/orgs.go:46

	if err != nil {
		log.Printf("Error listing orgs: %v\n", err)
		http.Error(w, "Error listing orgs: "+err.Error(), http.StatusInternalServerError)
		return
	}

	apiOrgs, apiErr := toApiOrgs(orgs)

	if apiErr != nil {
		log.Printf("Error converting orgs to api: %v\n", apiErr)
		writeApiError(w, *apiErr)
		return
	}

	bytes, err := json.Marshal(apiOrgs)

	if err != nil {
		log.Printf("Error marshalling response: %v\n", err)
		http.Error(w, "Error marshalling response: "+err.Error(), http.StatusInternalServerError)
		return
	}

	log.Println("Successfully listed orgs")

	w.Write(bytes)
}

func CreateOrgHandler(w http.ResponseWriter, r *http.Request) {
	log.Println("Received request for CreateOrgHandler")

	if os.Getenv("IS_CLOUD") != "" {
		writeApiError(w, shared.ApiError{
			Type:   shared.ApiErrorTypeOther,
			Status: http.StatusForbidden,
			Msg:    "Plandex Cloud orgs can only be created by starting a trial",
		})
		return

View on GitHub (pinned to e2d772072e)

Solutions

  1. Check the wrapped marshal error for the offending field
  2. Review MarshalJSON implementations on API org types
  3. Fix the type issue; no data was changed
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at app/server/handlers/orgs.go:46 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/11aa52424d1c3879. Report an issue: GitHub.