SigNoz/signoz · warning · model.ApiError

ErrorID missing from params

Error message

ErrorID missing from params

What it means

Returned by GetErrorFromErrorID when queryParams.ErrorID is an empty string. It is a client-side validation failure (model.ErrorBadData) raised before any ClickHouse query is executed.

Source

Thrown at pkg/query-service/app/clickhouseReader/reader.go:2342

	if err != nil {
		r.logger.Error("Error in processing sql query", errorsV2.Attr(err))
		return 0, &model.ApiError{Typ: model.ErrorExec, Err: fmt.Errorf("error in processing sql query")}
	}

	return errorCount, nil
}

func (r *ClickHouseReader) GetErrorFromErrorID(ctx context.Context, queryParams *model.GetErrorParams) (*model.ErrorWithSpan, *model.ApiError) {

	ctx = ctxtypes.NewContextWithCommentVals(ctx, map[string]string{
		instrumentationtypes.TelemetrySignal:  telemetrytypes.SignalTraces.StringValue(),
		instrumentationtypes.CodeNamespace:    "clickhouse-reader",
		instrumentationtypes.CodeFunctionName: "GetErrorFromErrorID",
	})
	if queryParams.ErrorID == "" {
		r.logger.Error("errorId missing from params")
		return nil, &model.ApiError{Typ: model.ErrorBadData, Err: fmt.Errorf("ErrorID missing from params")}
	}
	var getErrorWithSpanReponse []model.ErrorWithSpan

	query := fmt.Sprintf("SELECT errorID, exceptionType, exceptionStacktrace, exceptionEscaped, exceptionMessage, timestamp, spanID, traceID, serviceName, groupID FROM %s.%s WHERE timestamp = @timestamp AND groupID = @groupID AND errorID = @errorID LIMIT 1", r.TraceDB, r.errorTable)
	args := []interface{}{clickhouse.Named("errorID", queryParams.ErrorID), clickhouse.Named("groupID", queryParams.GroupID), clickhouse.Named("timestamp", strconv.FormatInt(queryParams.Timestamp.UnixNano(), 10))}

	err := r.db.Select(ctx, &getErrorWithSpanReponse, query, args...)
	r.logger.Info(query)

	if err != nil {
		r.logger.Error("Error in processing sql query", errorsV2.Attr(err))
		return nil, &model.ApiError{Typ: model.ErrorExec, Err: fmt.Errorf("error in processing sql query")}
	}

	if len(getErrorWithSpanReponse) > 0 {
		return &getErrorWithSpanReponse[0], nil
	} else {
		return nil, &model.ApiError{Typ: model.ErrorNotFound, Err: fmt.Errorf("Error/Exception not found")}

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Always supply a non-empty ErrorID in GetErrorParams
  2. Validate the request at the API layer (reject empty errorId with 400 before reaching the reader)
  3. Default-or-fail fast in callers: if you cannot resolve an errorId, skip the detail lookup
  4. Add a test asserting errorId is set before calling GetErrorFromErrorID

Example fix

// before
params := &model.GetErrorParams{} // ErrorID empty -> ErrorID missing from params
// after
if queryParams.ErrorID == "" { return 400 "errorId is required" }
params := &model.GetErrorParams{ErrorID: "abcdef123", GroupID: "...", Timestamp: ts}
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(req.ErrorID) == "" { return 400, errors.New("errorId is required") }
params := &model.GetErrorParams{ErrorID: req.ErrorID, GroupID: req.GroupID, Timestamp: req.Timestamp}

Type guard

func hasErrorID(p *model.GetErrorParams) bool { return p != nil && p.ErrorID != "" }

Try / catch

if apiErr, ok := err.(*model.ApiError); ok && apiErr.Typ == model.ErrorBadData { return 400, apiErr.Err }

Prevention

When it happens

Trigger: Calling the get-error-detail endpoint with a missing or empty errorId in the request, e.g. /api/v1/errors/ (empty ID segment) or a JSON body without errorID.

Common situations: Frontend constructing the URL from an unset field, API clients omitting errorId, integration tests passing empty structs, scripts with unpopulated params after refactors.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


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