plandex-ai/plandex · error

error fetching custom models: %v

Error message

error fetching custom models: %v

What it means

GetServerModelsInput fetches custom models/providers via three goroutines communicating over an errCh; if any of the three results carries a non-nil error it aborts with 'error fetching custom models: %v'. It aggregates a failure in retrieving server-side custom model configuration.

Source

Thrown at app/cli/lib/custom_models.go:80

		modelPacks, apiErr := api.Client.ListModelPacks()
		if apiErr != nil {
			errCh <- apiErr
			return
		}

		schemas := make([]*shared.ModelPackSchema, len(modelPacks))
		for i, modelPack := range modelPacks {
			schemas[i] = modelPack.ToModelPackSchema()
		}

		customModelPacks = schemas
		errCh <- nil
	}()

	for i := 0; i < 3; i++ {
		err := <-errCh
		if err != nil {
			return nil, fmt.Errorf("error fetching custom models: %v", err.Msg)
		}
	}

	serverModelsInput := &shared.ModelsInput{
		CustomModels:     customModels,
		CustomProviders:  customProviders,
		CustomModelPacks: customModelPacks,
	}

	return serverModelsInput, nil
}

func CustomModelsCheckLocalChanges(path string) (CustomModelsCheckLocalChangesResult, error) {
	hashPath := path + ".hash"

	exists, err := fs.FileExists(path)
	if err != nil {
		return CustomModelsCheckLocalChangesResult{}, err

View on GitHub (pinned to e2d772072e)

Solutions

  1. Read the wrapped inner error (err.Msg) for the failing fetch's root cause
  2. Retry — transient server/network errors often clear on re-run (SyncCustomModels retries the flow)
  3. Verify authentication and that the models endpoint is reachable
  4. Review server-side custom models/providers for malformed entries and remove/fix them

Example fix

// before: first error aborts everything
for i := 0; i < 3; i++ {
    err := <-errCh
    if err != nil {
        return nil, fmt.Errorf("error fetching custom models: %v", err.Msg)
    }
}
// after: caller retries on failure
input, err := GetServerModelsInput(...)
if err != nil {
    return retry(3, func() error { _, err = GetServerModelsInput(...); return err })
}
Defensive patterns

Strategy: retry

Validate before calling

if err := pingModelsEndpoint(ctx); err != nil {
    return fmt.Errorf("models endpoint unreachable: %w", err)
}

Try / catch

input, err := GetServerModelsInput(...)
if err != nil && strings.Contains(err.Error(), "error fetching custom models") {
    // bounded retry for transient server/network failures
    for i := 0; i < 3; i++ {
        if input, err = GetServerModelsInput(...); err == nil {
            break
        }
        time.Sleep(backoff(i))
    }
}

Prevention

When it happens

Trigger: Any of the 3 parallel fetches (custom models, custom providers, or the third fetch) pushes an error onto errCh — e.g. server API call fails, auth error, or response parse failure while syncing custom models.

Common situations: API/server outage or network error while loading custom models; invalid API key; custom provider config on the server is malformed and fails to deserialize; timeout on the models endpoint.

Related errors


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