{"record":{"id":"8724b6d59cae7271","repo":"SigNoz/signoz","slug":"internal-8724b6","errorCode":"internal","errorMessage":"failed to start transaction","messagePattern":"failed to start transaction","errorType":"error_code","errorClass":"errors.base","httpStatus":500,"severity":"critical","filePath":"pkg/modules/tracefunnel/impltracefunnel/store.go","lineNumber":24,"sourceCode":"\n\t\"github.com/SigNoz/signoz/pkg/errors\"\n\t\"github.com/SigNoz/signoz/pkg/sqlstore\"\n\ttraceFunnels \"github.com/SigNoz/signoz/pkg/types/tracefunneltypes\"\n\t\"github.com/SigNoz/signoz/pkg/valuer\"\n)\n\ntype store struct {\n\tsqlstore sqlstore.SQLStore\n}\n\nfunc NewStore(sqlstore sqlstore.SQLStore) traceFunnels.FunnelStore {\n\treturn &store{sqlstore: sqlstore}\n}\n\nfunc (store *store) Create(ctx context.Context, funnel *traceFunnels.StorableFunnel) error {\n\ttx, err := store.sqlstore.BunDB().BeginTx(ctx, nil)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, errors.TypeInternal, errors.CodeInternal, \"failed to start transaction\")\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\t_ = tx.Rollback()\n\t\t}\n\t}()\n\n\t// Check if a funnel with the same name already exists in the organization\n\texists, err := tx.\n\t\tNewSelect().\n\t\tModel(new(traceFunnels.StorableFunnel)).\n\t\tWhere(\"name = ? AND org_id = ?\", funnel.Name, funnel.OrgID.String()).\n\t\tExists(ctx)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, errors.TypeInternal, errors.CodeInternal, \"failed to check for existing funnel\")\n\t}\n\tif exists {\n\t\treturn errors.Newf(errors.TypeAlreadyExists, errors.CodeAlreadyExists, \"a funnel with name '%s' already exists in this organization\", funnel.Name)","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/modules/tracefunnel/impltracefunnel/store.go#L6-L42","documentation":"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.","triggerScenarios":"POST a funnel when the Postgres/ClickHouse-compatible backend is down, connection pool exhausted, or context canceled before begin.","commonSituations":"DB outage or restart, max_connections reached, migrations holding locks, network partition between app and DB.","solutions":["Check database health and connectivity from the service","Inspect connection pool metrics; raise pool size or reduce concurrency","Check for ongoing migrations/locks blocking transactions","Retry after DB recovery; inspect server logs for the underlying driver error"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// preflight DB reachability\nif (!(await db.ping())) throw new Error('database unavailable');","typeGuard":null,"tryCatchPattern":"catch (e) {\n  if (e.code === 'internal' && /start transaction/.test(e.message)) return retryWithBackoff(createFunnel, funnel);\n  throw e;\n}","preventionTips":["Monitor connection pool utilization","Alert on DB health before users hit failures","Use idempotent create payloads so retries are safe"],"tags":["database","transaction","internal","trace-funnel"],"backgroundTag":"database-transaction-begin-failed","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}