plandex-ai/plandex · error

error getting custom model packs: %v

Error message

error getting custom model packs: %v

What it means

This error wraps a failure from api.Client.ListModelPacks() in set_model's parallel fetch (one of three goroutines feeding errCh). The *shared.ApiError Msg is interpolated into 'error getting custom model packs: %s'. It means the custom model packs listing failed, so the model selection flow cannot proceed.

Source

Thrown at app/cli/cmd/set_model.go:165

		for _, ms := range builtInModelPacks {
			if ms.LocalProvider == "" {
				filtered = append(filtered, ms)
			}
		}
		builtInModelPacks = filtered
	}

	var customModelPacks []*shared.ModelPack
	var defaultConfig *shared.PlanConfig
	var planConfig *shared.PlanConfig

	errCh := make(chan error, 3)

	go func() {
		var apiErr *shared.ApiError
		customModelPacks, apiErr = api.Client.ListModelPacks()
		if apiErr != nil {
			errCh <- fmt.Errorf("error getting custom model packs: %v", apiErr.Msg)
			return
		}
		errCh <- nil
	}()

	go func() {
		var apiErr *shared.ApiError
		defaultConfig, apiErr = api.Client.GetDefaultPlanConfig()
		if apiErr != nil {
			errCh <- fmt.Errorf("error getting default config: %v", apiErr.Msg)
			return
		}

		errCh <- nil
	}()

	go func() {
		if lib.CurrentPlanId != "" {

View on GitHub (pinned to e2d772072e)

Solutions

  1. Re-authenticate to refresh the API token
  2. Check the err.Msg embedded in the output for the HTTP status and message
  3. Verify network/proxy connectivity to the API host
  4. Confirm your org/account has access to custom model packs

Example fix

// before
errCh <- fmt.Errorf("error getting custom model packs: %v", apiErr.Msg)
// after
errCh <- fmt.Errorf("error getting custom model packs (status %d): %v", apiErr.Status, apiErr.Msg)
Defensive patterns

Strategy: retry

Validate before calling

// pre-flight: authenticated client with reachable API
if api.Client == nil {
	return fmt.Errorf("client not initialized: authenticate first")
}
if err := api.Client.HealthCheck(); err != nil {
	return fmt.Errorf("API unreachable: %w", err)
}

Type guard

func isApiErr(err error) (*shared.ApiError, bool) {
	ae, ok := err.(*shared.ApiError)
	return ae, ok
}

Try / catch

packs, err := retry(3, backoff, func() ([]ModelPack, error) {
	return api.Client.ListModelPacks()
})
if err != nil {
	if ae, ok := err.(*shared.ApiError); ok && ae.Status == 401 {
		return reauth()
	}
	return fmt.Errorf("error getting custom model packs: %w", err)
}

Prevention

When it happens

Trigger: ListModelPacks() returning non-nil *shared.ApiError: invalid or expired API credentials, network failure, or the server rejecting the request (403 for lacking model-pack access, 500 server error).

Common situations: Token expiry during long sessions; org plan without custom model packs enabled; API outage; firewall/proxy blocking the endpoint.

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/9107d29b7edd8543. Report an issue: GitHub.