plandex-ai/plandex · error · http

Error updating org user config:

Error message

Error updating org user config: 

What it means

UpdateOrgUserConfigHandler calls db.UpdateOrgUserConfig to persist an org-user config row for the authenticated user and org. When the underlying database update returns an error, the handler logs it and responds with HTTP 500 including the raw error string. This is a server-side persistence failure, not a client input problem.

Source

Thrown at app/server/handlers/sessions.go:341

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

	var req shared.OrgUserConfig
	err = json.Unmarshal(body, &req)
	if err != nil {
		log.Printf("Error unmarshalling request: %v\n", err)
		http.Error(w, "Error unmarshalling request: "+err.Error(), http.StatusInternalServerError)
		return
	}

	err = db.UpdateOrgUserConfig(auth.User.Id, auth.OrgId, &req)

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

	log.Println("Successfully updated org user config")
}

View on GitHub (pinned to e2d772072e)

Solutions

  1. Check the server log line to see the wrapped DB error and fix the underlying cause
  2. Verify the user/org record exists before updating (insert-or-upsert instead of update)
  3. Check database connectivity and credentials of the server's DB connection
  4. Validate the request payload against the OrgUserConfig schema before calling UpdateOrgUserConfig
  5. Confirm DB migrations are up to date for the org_user_configs table

Example fix

// before
err = db.UpdateOrgUserConfig(auth.User.Id, auth.OrgId, &req)
// after
if err := validateOrgUserConfig(&req); err != nil {
    http.Error(w, "Invalid org user config: "+err.Error(), http.StatusBadRequest)
    return
}
err = db.UpdateOrgUserConfig(auth.User.Id, auth.OrgId, &req)
Defensive patterns

Strategy: validation

Validate before calling

if req == nil || auth == nil || auth.User == nil || auth.OrgId == "" {
    return errors.New("missing auth or empty request")
}

Try / catch

resp, err := client.UpdateOrgUserConfig(ctx, req)
if err != nil {
    if strings.Contains(err.Error(), "Error updating org user config") {
        // server-side persistence failed: check server logs / retry later
    }
    return err
}

Prevention

When it happens

Trigger: db.UpdateOrgUserConfig(auth.User.Id, auth.OrgId, &req) returns a non-nil error: database connection failure, constraint violation, invalid config JSON, missing user/org row, or storage backend unavailable.

Common situations: Postgres/DB is down or unreachable; the org-user row does not exist for the given auth.OrgId and user id; config payload violates a schema or size constraint; DB migration drift between server versions.

Related errors


AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05). Data as JSON: /api/errors/ed52e9f48587c418. Report an issue: GitHub.