plandex-ai/plandex · error · http
Error getting default settings
Error message
Error getting default settings
What it means
GetDefaultSettingsHandler fetches the org's default plan settings via db.GetOrgDefaultSettings. When that DB query returns any error (connection failure, missing row scan error, context cancellation), the handler logs it and responds 500 with a generic 'Error getting default settings' body, deliberately hiding the underlying DB error from the client.
Source
Thrown at app/server/handlers/settings.go:237
w.Write(bytes)
log.Println("UpdateSettingsHandler processed successfully")
}
func GetDefaultSettingsHandler(w http.ResponseWriter, r *http.Request) {
log.Println("Received request for GetDefaultSettingsHandler")
auth := Authenticate(w, r, true)
if auth == nil {
return
}
settings, err := db.GetOrgDefaultSettings(auth.OrgId)
if err != nil {
log.Println("Error getting default settings: ", err)
http.Error(w, "Error getting default settings", http.StatusInternalServerError)
return
}
bytes, err := json.Marshal(settings)
if err != nil {
log.Println("Error marshalling default settings: ", err)
http.Error(w, "Error marshalling default settings", http.StatusInternalServerError)
return
}
w.Write(bytes)
log.Println("GetDefaultSettingsHandler processed successfully")
}
func UpdateDefaultSettingsHandler(w http.ResponseWriter, r *http.Request) {
log.Println("Received request for UpdateDefaultSettingsHandler")View on GitHub (pinned to e2d772072e)
Solutions
- Check the server log for the 'Error getting default settings:' line to see the underlying DB error
- Verify the database is reachable and migrations are up to date
- Confirm the org ID in the auth token still exists in the orgs table
- If scans fail after an upgrade, redeploy server and shared lib versions together
- Retry the request once the DB is healthy
Example fix
// before
settings, err := db.GetOrgDefaultSettings(auth.OrgId)
if err != nil {
http.Error(w, "Error getting default settings", http.StatusInternalServerError)
return
}
// after
settings, err := db.GetOrgDefaultSettings(auth.OrgId)
if err != nil {
if errors.Is(err, sql.ErrNoRows) {
http.Error(w, "No default settings found for org", http.StatusNotFound)
return
}
log.Println("Error getting default settings: ", err)
http.Error(w, "Error getting default settings", http.StatusInternalServerError)
return
} Defensive patterns
Strategy: retry
Validate before calling
// client-side pre-check
if (!orgId) throw new Error('orgId is required before fetching default settings');
const res = await fetch(`${base}/org/default-settings`, { headers: authHeaders });
if (!res.ok && res.status >= 500) scheduleRetry(); Type guard
func isRetryableDBError(err error) bool {
var netErr net.Error
return errors.As(err, &netErr) || errors.Is(err, sql.ErrConnDone) || errors.Is(err, driver.ErrBadConn)
} Try / catch
try {
const res = await api.getDefaultSettings();
} catch (e) {
if (e.status === 500) { logServerIssue(e); await waitForDbHealthy(); retry(); }
else throw e;
} Prevention
- Keep migrations applied before deploying server updates
- Monitor DB health/uptime and alert on outages
- Retry idempotent GETs on 5xx with backoff
- Check server logs for the underlying DB error on any 500
When it happens
Trigger: GET the org default settings endpoint when the database is unreachable, the org row/default-settings row is missing or corrupt, the SQL scan fails due to schema drift, or the request context is cancelled mid-query.
Common situations: Postgres down or restarted during a deploy; org deleted while a stale auth token still references its ID; migrations not applied so the settings table/columns don't match the struct; connection pool exhausted under load.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- Error updating default settings
- error getting plan settings: %v
- error getting current plan state params: %v
- error getting contexts: %v
- error loading plan: %v
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/8b084e241d62be13.
Report an issue: GitHub.