plandex-ai/plandex · error
error creating custom provider: %w
Error message
error creating custom provider: %w
What it means
Returned inside the db.WithTx transaction that persists custom models/providers/model packs, when db.UpsertCustomProvider fails to insert or update one of the submitted custom providers. The error propagates out of the transaction closure, aborting and rolling back the entire batch, so no partial set of custom model changes is committed. The underlying %w carries the database-layer failure (constraint violation, connection issue, etc.).
Source
Thrown at app/server/handlers/models.go:299
}
numChanges := len(toUpsertCustomModels) + len(toUpsertCustomProviders) + len(toUpsertModelPacks) + len(toDeleteCustomModelIds) + len(toDeleteCustomProviderIds) + len(toDeleteModelPackIds)
if numChanges == 0 {
w.WriteHeader(http.StatusOK)
log.Println("No changes to custom models/providers/model packs")
return
}
err = db.WithTx(r.Context(), "create custom models/providers/model packs", func(tx *sqlx.Tx) error {
for _, model := range toUpsertCustomModels {
if err := db.UpsertCustomModel(tx, model); err != nil {
return fmt.Errorf("error creating custom model: %w", err)
}
}
for _, provider := range toUpsertCustomProviders {
if err := db.UpsertCustomProvider(tx, provider); err != nil {
return fmt.Errorf("error creating custom provider: %w", err)
}
}
for _, modelPack := range toUpsertModelPacks {
if err := db.UpsertModelPack(tx, modelPack); err != nil {
return fmt.Errorf("error creating model pack: %w", err)
}
}
if len(toDeleteCustomModelIds) > 0 {
if err := db.DeleteCustomModels(tx, auth.OrgId, toDeleteCustomModelIds); err != nil {
return fmt.Errorf("error deleting custom models: %w", err)
}
}
if len(toDeleteCustomProviderIds) > 0 {
if err := db.DeleteCustomProviders(tx, auth.OrgId, toDeleteCustomProviderIds); err != nil {
return fmt.Errorf("error deleting custom providers: %w", err)View on GitHub (pinned to e2d772072e)
Solutions
- Check the wrapped error for the failing provider
- Verify provider name/id uniqueness for the org
- Correct the payload and re-submit the sync request
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at app/server/handlers/models.go:299 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/6396f19a8100143b.
Report an issue: GitHub.