plandex-ai/plandex · error

client not found for provider composite: %s

Error message

client not found for provider composite: %s

What it means

CreateChatCompletionStream computes a provider composite key (provider + auth/settings/org config) via modelConfig.GetProviderComposite and looks it up in the pre-initialized clients map. If no client was registered for that composite (unsupported provider, missing API key, bad model config), it returns this error and no stream is created.

Source

Thrown at app/server/model/client.go:121

// JSONUnmarshaler handles JSON unmarshaling for stream responses
type JSONUnmarshaler struct{}

func CreateChatCompletionStream(
	clients map[string]ClientInfo,
	authVars map[string]string,
	modelConfig *shared.ModelRoleConfig,
	settings *shared.PlanSettings,
	orgUserConfig *shared.OrgUserConfig,
	currentOrgId string,
	currentUserId string,
	ctx context.Context,
	req types.ExtendedChatCompletionRequest,
) (*ExtendedChatCompletionStream, error) {
	providerComposite := modelConfig.GetProviderComposite(authVars, settings, orgUserConfig)
	_, ok := clients[providerComposite]
	if !ok {
		return nil, fmt.Errorf("client not found for provider composite: %s", providerComposite)
	}

	baseModelConfig := modelConfig.GetBaseModelConfig(authVars, settings, orgUserConfig)

	// ensure the model name is set correctly on fallbacks
	req.Model = baseModelConfig.ModelName

	resolveReq(&req, modelConfig, baseModelConfig, settings)

	// choose the fastest provider by latency/throughput on openrouter
	if baseModelConfig.Provider == shared.ModelProviderOpenRouter {
		if !strings.HasSuffix(string(req.Model), ":nitro") && !strings.HasSuffix(string(req.Model), ":free") && !strings.HasSuffix(string(req.Model), ":floor") {
			req.Model += ":nitro"
		}
	}

	if baseModelConfig.ReasoningBudget > 0 {
		req.ReasoningConfig = &types.ReasoningConfig{

View on GitHub (pinned to e2d772072e)

Solutions

  1. Set the missing provider API key env var(s) so the client is registered in the clients map at startup.
  2. Check the log's composite string and confirm that provider is supported by this build.
  3. Fix the model/provider selection in plan or org settings to a provider with configured credentials.
  4. If adding a new provider, register its client in the clients map initialization code.

Example fix

// before
OPENAI_API_KEY=   # empty -> no client registered
// after
OPENAI_API_KEY=sk-...  # client registered for provider composite openai
Defensive patterns

Strategy: type-guard

Validate before calling

// Go - verify a client exists before requesting a stream
providerComposite := modelConfig.GetProviderComposite(authVars, settings, orgUserConfig)
if _, ok := clients[providerComposite]; !ok {
    return fmt.Errorf("provider %s is not configured: check provider API keys", providerComposite)
}

Type guard

func clientConfigured(clients map[string]ClientInfo, providerComposite string) bool {
    _, ok := clients[providerComposite]
    return ok
}

Try / catch

stream, err := model.CreateChatCompletionStream(clients, authVars, modelConfig, settings, orgUserConfig, orgId, userId, ctx, req)
if err != nil {
    if strings.Contains(err.Error(), "client not found for provider composite") {
        return fmt.Errorf("provider not configured; set the provider API key or choose another model: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: The configured model's provider has no registered client: model string names an unsupported provider, required auth var (e.g. OPENAI_API_KEY / ANTHROPIC_API_KEY) is missing so the client was never initialized, org/user settings override the provider to one not in the clients map, or a typo in the provider name in settings.

Common situations: After switching models in plan settings to a provider without credentials configured; self-hosted deployments missing provider env vars; new provider added to model config but client registry not updated; OpenRouter/custom provider key not set.

Related errors


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