{"record":{"id":"11aa52424d1c3879","repo":"plandex-ai/plandex","slug":"error-marshalling-response-11aa52","errorCode":null,"errorMessage":"Error marshalling response: ","messagePattern":"Error marshalling response: ","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"app/server/handlers/orgs.go","lineNumber":46,"sourceCode":"\tif err != nil {\n\t\tlog.Printf(\"Error listing orgs: %v\\n\", err)\n\t\thttp.Error(w, \"Error listing orgs: \"+err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tapiOrgs, apiErr := toApiOrgs(orgs)\n\n\tif apiErr != nil {\n\t\tlog.Printf(\"Error converting orgs to api: %v\\n\", apiErr)\n\t\twriteApiError(w, *apiErr)\n\t\treturn\n\t}\n\n\tbytes, err := json.Marshal(apiOrgs)\n\n\tif err != nil {\n\t\tlog.Printf(\"Error marshalling response: %v\\n\", err)\n\t\thttp.Error(w, \"Error marshalling response: \"+err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tlog.Println(\"Successfully listed orgs\")\n\n\tw.Write(bytes)\n}\n\nfunc CreateOrgHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"Received request for CreateOrgHandler\")\n\n\tif os.Getenv(\"IS_CLOUD\") != \"\" {\n\t\twriteApiError(w, shared.ApiError{\n\t\t\tType:   shared.ApiErrorTypeOther,\n\t\t\tStatus: http.StatusForbidden,\n\t\t\tMsg:    \"Plandex Cloud orgs can only be created by starting a trial\",\n\t\t})\n\t\treturn","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/handlers/orgs.go#L28-L64","documentation":"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.","triggerScenarios":"Thrown at app/server/handlers/orgs.go:46 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped marshal error for the offending field","Review MarshalJSON implementations on API org types","Fix the type issue; no data was changed"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}