plandex-ai/plandex · error

error getting settings: %v

Error message

error getting settings: %v

What it means

This error wraps a failure from api.Client.GetSettings(CurrentPlanId, CurrentBranch), the API call that fetches the plan's server-side settings. The client wraps any transport, auth, or API-level error with this message. It means the local/server hash comparison could not proceed because the server settings were unreachable or rejected.

Source

Thrown at app/cli/lib/model_settings.go:178

		return false, fmt.Errorf("error reading JSON file: %v", err)
	}

	var clientModelPackSchemaRoles *shared.ClientModelPackSchemaRoles
	err = json.Unmarshal(jsonData, &clientModelPackSchemaRoles)
	if err != nil {
		return false, fmt.Errorf("error unmarshalling JSON file: %v", err)
	}

	modelPackSchemaRoles := clientModelPackSchemaRoles.ToModelPackSchemaRoles()

	localHash, err := modelPackSchemaRoles.Hash()
	if err != nil {
		return false, fmt.Errorf("error hashing model pack: %v", err)
	}

	settings, apiErr := api.Client.GetSettings(CurrentPlanId, CurrentBranch)
	if apiErr != nil {
		return false, fmt.Errorf("error getting settings: %v", apiErr)
	}

	serverHash, err := settings.GetModelPack().ToModelPackSchema().ModelPackSchemaRoles.Hash()
	if err != nil {
		return false, fmt.Errorf("error hashing model pack: %v", err)
	}

	if localHash == serverHash {
		return false, nil
	}

	err = WriteModelSettingsFile(path, settings)
	if err != nil {
		return false, fmt.Errorf("error writing model settings file: %v", err)
	}

	return true, nil
}

View on GitHub (pinned to e2d772072e)

Solutions

  1. Check network connectivity and any proxy configuration (HTTP_PROXY/HTTPS_PROXY).
  2. Re-authenticate (e.g. re-login) if the token is expired; the inner apiErr will show 401/403.
  3. Verify CurrentPlanId and CurrentBranch are valid — run the command that lists plans/branches to confirm they exist.
  4. Retry after a transient outage; add retry-with-backoff around GetSettings for flaky networks.

Example fix

// before: single attempt, wraps err (note: in SyncPlanModelSettings sibling code the wrong variable is wrapped)
settings, apiErr := api.Client.GetSettings(CurrentPlanId, CurrentBranch)
if apiErr != nil {
    return false, fmt.Errorf("error getting settings: %v", apiErr)
}
// after: retry transient failures
var settings *shared.Settings
var apiErr error
for i := 0; i < 3; i++ {
    settings, apiErr = api.Client.GetSettings(CurrentPlanId, CurrentBranch)
    if apiErr == nil {
        break
    }
    time.Sleep(time.Duration(1<<i) * time.Second)
}
if apiErr != nil {
    return false, fmt.Errorf("error getting settings: %w", apiErr)
}
Defensive patterns

Strategy: retry

Validate before calling

// Pre-flight connectivity/auth check before calling
req, _ := http.NewRequest("GET", apiBase+"/health", nil)
resp, err := http.DefaultClient.Do(req)
if err != nil {
    return fmt.Errorf("API unreachable, GetSettings will fail: %w", err)
}
resp.Body.Close()

Type guard

func isAuthError(err error) bool {
    return err != nil && (strings.Contains(err.Error(), "401") || strings.Contains(err.Error(), "403"))
}

Try / catch

updated, err := lib.SaveLatestPlanModelSettingsIfNeeded()
if err != nil && strings.Contains(err.Error(), "error getting settings") {
    if isAuthError(err) {
        return reloginAndRetry()
    }
    return retryWithBackoff(3, time.Second, retry)
}

Prevention

When it happens

Trigger: GetSettings fails due to: no network / DNS failure, expired or invalid auth token, the plan ID or branch not existing server-side (404), server 5xx, or a request timeout.

Common situations: Working offline or behind a corporate proxy; API key rotated or expired session; CurrentPlanId/CurrentBranch stale after the plan was deleted or renamed; API server temporarily down during maintenance.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


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