SigNoz/signoz · error

invalid_input

invalid_input

Error message

field `%s` not found

What it means

Thrown by ColumnExpressionFor in the telemetry metadata field mapper when the requested field name does not match any known key (context-provided keys, static fields, or materialised keys). It wraps the underlying not-found error and attaches Levenshtein-distance suggestions for similarly named keys, so the message 'field `%s` not found' is a user-input (invalid_input) error rather than an infrastructure failure.

Source

Thrown at pkg/telemetrymetadata/field_mapper.go:116

	fieldExpression, err := m.FieldFor(ctx, orgID, startNs, endNs, field)
	if errors.Is(err, qbtypes.ErrColumnNotFound) {
		// the key didn't have the right context to be added to the query
		// we try to use the context we know of
		keysForField := keys[field.Name]
		if len(keysForField) == 0 {
			// is it a static field?
			if _, ok := attributeMetadataColumns[field.Name]; ok {
				// if it is, attach the column name directly
				field.FieldContext = telemetrytypes.FieldContextSpan
				fieldExpression, _ = m.FieldFor(ctx, orgID, startNs, endNs, field)
			} else {
				// - the context is not provided
				// - there are not keys for the field
				// - it is not a static field
				// - the next best thing to do is see if there is a typo
				// and suggest a correction
				wrappedErr := errors.Wrapf(err, errors.TypeInvalidInput, errors.CodeInvalidInput, "field `%s` not found", field.Name).WithSuggestions(errors.NewSuggestionsOnLevenshteinDistance(field.Name, errors.NounKeys, maps.Keys(keys))...)
				return "", wrappedErr
			}
		} else if len(keysForField) == 1 {
			// we have a single key for the field, use it
			fieldExpression, _ = m.FieldFor(ctx, orgID, startNs, endNs, keysForField[0])
		} else {
			// select any non-empty value from the keys
			args := []string{}
			for _, key := range keysForField {
				fieldExpression, _ = m.FieldFor(ctx, orgID, startNs, endNs, key)
				args = append(args, fmt.Sprintf("toString(%s) != '', toString(%s)", fieldExpression, fieldExpression))
			}
			fieldExpression = fmt.Sprintf("multiIf(%s, NULL)", strings.Join(args, ", "))
		}
	}

	return fmt.Sprintf("%s AS `%s`", sqlbuilder.Escape(fieldExpression), field.Name), nil
}

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Check the attached suggestions (Levenshtein matches) and use the suggested field name
  2. List available keys first via GetKeys/GetKeysMulti for the same signal, org, and time range, and pick the exact name
  3. Verify the field exists as a static/intrinsic field for that signal; if not, ensure telemetry containing it has been ingested in the queried window
  4. If the field was renamed, update the caller to the new name or add an alias

Example fix

// before
expr, err := mapper.ColumnExpressionFor(ctx, orgID, startNs, endNs, telemetrytypes.Field{Name: "servicName"})

// after
// inspect err suggestions, then:
expr, err := mapper.ColumnExpressionFor(ctx, orgID, startNs, endNs, telemetrytypes.Field{Name: "serviceName"})
Defensive patterns

Strategy: validation

Validate before calling

// Fetch known keys first and check the field name before mapping
keys, _, err := meta.GetKeys(ctx, orgID, signal, startNs, endNs, telemetrytypes.FieldSelector{})
if err != nil { return err }
known := make(map[string]struct{}, len(keys))
for _, k := range keys { known[k.Name] = struct{}{} }
if _, ok := known[field.Name]; !ok {
    return fmt.Errorf("unknown field %q; check available keys", field.Name)
}

Type guard

func isKnownField(field string, keys []*telemetrytypes.TelemetryFieldKey) bool {
    for _, k := range keys {
        if k.Name == field { return true }
    }
    return false
}

Try / catch

// After calling ColumnExpressionFor:
if err != nil {
    if e, ok := err.(*errors.Error); ok && e.Code == errors.CodeInvalidInput {
        for _, s := range e.Suggestions() { /* offer correction to user */ }
    }
    return err
}

Prevention

When it happens

Trigger: Calling ColumnExpressionFor with a field whose Name is misspelled or unknown for the org/time range, e.g. 'servicName' instead of 'serviceName', when the field is not a static field and no matching key exists in the fetched key set.

Common situations: Typos in query-builder / filter field names, fields that only exist in other environments or after new telemetry is ingested, renamed fields after a schema migration, or querying fields outside the selected time range so no keys were materialised.

Related errors


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