plandex-ai/plandex · error

Error getting integrated models

Error message

Error getting integrated models

What it means

initClients executes the getIntegratedModels hook (hooks.ExecHook) to resolve integrated-model credentials and returns HTTP 500 'Error getting integrated models' if the hook returns an error. On cloud deployments this hook typically calls an external service/DB to fetch org-integrated model auth; failure here blocks any plan operation that needs LLM clients.

Source

Thrown at app/server/handlers/client_helper.go:58

		authVars = params.authVars
	} else if params.apiKeys != nil {
		authVars = map[string]string{}
		for envVar, apiKey := range params.apiKeys {
			authVars[envVar] = apiKey
		}
		if params.openAIOrgId != "" {
			authVars["OPENAI_ORG_ID"] = params.openAIOrgId
		}
	}

	hookResult, apiErr := hooks.ExecHook(hooks.GetIntegratedModels, hooks.HookParams{
		Auth: params.auth,
		Plan: params.plan,
	})

	if apiErr != nil {
		log.Printf("Error getting integrated models: %v\n", apiErr)
		http.Error(w, "Error getting integrated models", http.StatusInternalServerError)
		return initClientsResult{}
	}

	if hookResult.GetIntegratedModelsResult != nil && hookResult.GetIntegratedModelsResult.IntegratedModelsMode {
		merged := map[string]string{}
		for k, v := range hookResult.GetIntegratedModelsResult.AuthVars {
			merged[k] = v
		}
		if authVars[shared.AnthropicClaudeMaxTokenEnvVar] != "" {
			merged[shared.AnthropicClaudeMaxTokenEnvVar] = authVars[shared.AnthropicClaudeMaxTokenEnvVar]
		}
		authVars = merged
	}
	if len(authVars) == 0 && os.Getenv("IS_CLOUD") != "" {
		log.Println("No api keys/credentials provided for models")
		http.Error(w, "No api keys/credentials provided for models", http.StatusBadRequest)
		return initClientsResult{}
	}

View on GitHub (pinned to e2d772072e)

Solutions

  1. Check server logs for the logged apiErr from ExecHook to find the root cause
  2. Verify the integrated-models backing service/database is reachable from the server
  3. Confirm the org's model integrations are configured and credentials valid in the dashboard
  4. Retry the plan operation once the integration service recovers

Example fix

// before
hookResult, apiErr := hooks.ExecHook(hooks.GetIntegratedModels, params) // ignored error handling
// after
hookResult, apiErr := hooks.ExecHook(hooks.GetIntegratedModels, params)
if apiErr != nil {
    return fmt.Errorf("get integrated models: %w", apiErr) // surface root cause to logs/client
}
Defensive patterns

Strategy: retry

Validate before calling

// client: preflight that model integrations are configured
settings, err := client.GetPlanSettings(planId)
if err != nil { return err }
if len(orgIntegratedModels) == 0 && len(authVars) == 0 {
    return errors.New("no model credentials or integrations configured")
}

Try / catch

// retry on 500; surface body for diagnosis
for attempt := 0; attempt < 3; attempt++ {
    resp, err := client.Do(req)
    if err == nil && resp.StatusCode == 200 { break }
    time.Sleep(time.Duration(1<<attempt) * time.Second)
}

Prevention

When it happens

Trigger: Any handler path through initClients (loadContexts, ApplyPlanHandler, TellPlanHandler, BuildPlanHandler) when the integrated-models hook errors — its backing store unreachable, the hook's external integration service down, or auth context making the hook's query fail.

Common situations: Cloud deployment where the integration service or database behind the hook is down; misconfigured server env for the integrations backend; org's integration credentials revoked causing the hook call to error; network egress blocked from the server to the integration service.

Related errors


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