SigNoz/signoz · error

invalid data source: %s

Error message

invalid data source: %s

What it means

DataSource.Validate accepts only traces, logs, metrics, and meter data sources. Any other string (typo, empty, or a source not supported by this build) is rejected. It is called from other Validate methods, so it often surfaces as part of query/rule validation.

Source

Thrown at pkg/query-service/model/v3/v3.go:36

	qbtypes "github.com/SigNoz/signoz/pkg/types/querybuildertypes/querybuildertypesv5"
)

type DataSource string

const (
	DataSourceTraces  DataSource = "traces"
	DataSourceLogs    DataSource = "logs"
	DataSourceMetrics DataSource = "metrics"
	DataSourceMeter   DataSource = "meter"
)

func (d DataSource) Validate() error {
	switch d {
	case DataSourceTraces, DataSourceLogs, DataSourceMetrics, DataSourceMeter:
		return nil
	default:
		return fmt.Errorf("invalid data source: %s", d)
	}
}

type AggregateOperator string

const (
	AggregateOperatorNoOp          AggregateOperator = "noop"
	AggregateOperatorCount         AggregateOperator = "count"
	AggregateOperatorCountDistinct AggregateOperator = "count_distinct"
	AggregateOperatorSum           AggregateOperator = "sum"
	AggregateOperatorAvg           AggregateOperator = "avg"
	AggregateOperatorMin           AggregateOperator = "min"
	AggregateOperatorMax           AggregateOperator = "max"
	AggregateOperatorP05           AggregateOperator = "p05"
	AggregateOperatorP10           AggregateOperator = "p10"
	AggregateOperatorP20           AggregateOperator = "p20"
	AggregateOperatorP25           AggregateOperator = "p25"
	AggregateOperatorP50           AggregateOperator = "p50"

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Use exactly one of: traces, logs, metrics, meter (the v3.DataSource constants)
  2. Check the DataSource constants in pkg/query-service/model/v3 for the supported list in your version
  3. Upgrade/downgrade align client and server enums

Example fix

// before
{"dataSource":"Trace","compositeQuery":...}

// after
{"dataSource":"traces","compositeQuery":...}
Defensive patterns

Strategy: type-guard

Validate before calling

if err := ds.Validate(); err != nil {
    return fmt.Errorf("bad data source: %v", err)
}

Type guard

func isValidDataSource(d v3.DataSource) bool {
    switch d {
    case v3.DataSourceTraces, v3.DataSourceLogs, v3.DataSourceMetrics, v3.DataSourceMeter:
        return true
    }
    return false
}

Prevention

When it happens

Trigger: Constructing a query or rule JSON with dataSource set to something like 'Trace', '', 'spans', or an unshipped source; also when a composite query's data source doesn't match one of the v3 constants.

Common situations: Hand-written API payloads with wrong casing; enum drift between a custom frontend and the query-service version; copy-pasting examples that reference non-existent sources.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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