SigNoz/signoz · warning

%s

Error message

%s

What it means

WrapNotFoundErrf in the postgres sqlstore provider rewrites sql.ErrNoRows into a typed error with errors.TypeNotFound and the caller-supplied code/format — this '%s' format string is the caller's message applied to the no-rows error.

Source

Thrown at ee/sqlstore/postgressqlstore/provider.go:109

func (provider *provider) Dialect() sqlstore.SQLDialect {
	return provider.dialect
}

func (provider *provider) Formatter() sqlstore.SQLFormatter {
	return provider.formatter
}

func (provider *provider) BunDBCtx(ctx context.Context) bun.IDB {
	return provider.bundb.BunDBCtx(ctx)
}

func (provider *provider) RunInTxCtx(ctx context.Context, opts *sql.TxOptions, cb func(ctx context.Context) error) error {
	return provider.bundb.RunInTxCtx(ctx, opts, cb)
}

func (provider *provider) WrapNotFoundErrf(err error, code errors.Code, format string, args ...any) error {
	if err == sql.ErrNoRows {
		return errors.Wrapf(err, errors.TypeNotFound, code, format, args...)
	}

	return err
}

func (provider *provider) WrapAlreadyExistsErrf(err error, code errors.Code, format string, args ...any) error {
	var pgErr *pgconn.PgError
	if errors.As(err, &pgErr) && (pgErr.Code == "23505" || pgErr.Code == "23503") {
		return errors.Wrapf(err, errors.TypeAlreadyExists, code, format, args...)
	}

	return err
}

func (dialect *dialect) ToggleForeignKeyConstraint(ctx context.Context, bun *bun.DB, enable bool) error {
	return nil
}

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Handle the returned NotFound error as an HTTP 404 rather than 500 in the caller layer
  2. Verify the entity ID exists (and org scoping) before the read
  3. Seed/re-create missing required rows if the entity should exist
  4. Check for accidental table truncation or wrong database/database selection
Defensive patterns

Strategy: try-catch

Try / catch

err := store.WrapNotFoundErrf(dbErr, code, "license %s not found", id)
if errors.Ast(err, errors.TypeNotFound) { return http.StatusNotFound }

Prevention

When it happens

Trigger: Any repository read (Get/First by unique key) that returns sql.ErrNoRows while using provider.WrapNotFoundErrf, e.g. fetching a license/org/API-key by ID that does not exist.

Common situations: API 404s for missing entities; deleted rows still referenced; querying with the wrong org context or a stale ID from a previous deployment.

Related errors


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