SigNoz/signoz · critical · errors.base

internal

internal

Error message

failed to start transaction

What it means

The funnel store could not begin a SQL transaction (BunDB BeginTx failed) while creating a funnel. Indicates a database connectivity/availability problem, not bad input.

Source

Thrown at pkg/modules/tracefunnel/impltracefunnel/store.go:24

	"github.com/SigNoz/signoz/pkg/errors"
	"github.com/SigNoz/signoz/pkg/sqlstore"
	traceFunnels "github.com/SigNoz/signoz/pkg/types/tracefunneltypes"
	"github.com/SigNoz/signoz/pkg/valuer"
)

type store struct {
	sqlstore sqlstore.SQLStore
}

func NewStore(sqlstore sqlstore.SQLStore) traceFunnels.FunnelStore {
	return &store{sqlstore: sqlstore}
}

func (store *store) Create(ctx context.Context, funnel *traceFunnels.StorableFunnel) error {
	tx, err := store.sqlstore.BunDB().BeginTx(ctx, nil)
	if err != nil {
		return errors.Wrapf(err, errors.TypeInternal, errors.CodeInternal, "failed to start transaction")
	}
	defer func() {
		if err != nil {
			_ = tx.Rollback()
		}
	}()

	// Check if a funnel with the same name already exists in the organization
	exists, err := tx.
		NewSelect().
		Model(new(traceFunnels.StorableFunnel)).
		Where("name = ? AND org_id = ?", funnel.Name, funnel.OrgID.String()).
		Exists(ctx)
	if err != nil {
		return errors.Wrapf(err, errors.TypeInternal, errors.CodeInternal, "failed to check for existing funnel")
	}
	if exists {
		return errors.Newf(errors.TypeAlreadyExists, errors.CodeAlreadyExists, "a funnel with name '%s' already exists in this organization", funnel.Name)

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Check database health and connectivity from the service
  2. Inspect connection pool metrics; raise pool size or reduce concurrency
  3. Check for ongoing migrations/locks blocking transactions
  4. Retry after DB recovery; inspect server logs for the underlying driver error
Defensive patterns

Strategy: retry

Validate before calling

// preflight DB reachability
if (!(await db.ping())) throw new Error('database unavailable');

Try / catch

catch (e) {
  if (e.code === 'internal' && /start transaction/.test(e.message)) return retryWithBackoff(createFunnel, funnel);
  throw e;
}

Prevention

When it happens

Trigger: POST a funnel when the Postgres/ClickHouse-compatible backend is down, connection pool exhausted, or context canceled before begin.

Common situations: DB outage or restart, max_connections reached, migrations holding locks, network partition between app and DB.

Related errors


AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28). Data as JSON: /api/errors/8724b6d59cae7271. Report an issue: GitHub.