{"record":{"id":"545779cbe5784830","repo":"SigNoz/signoz","slug":"invalid-input-545779","errorCode":"invalid_input","errorMessage":"field `%s` not found","messagePattern":"field `(.+?)` not found","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/telemetrymetadata/field_mapper.go","lineNumber":116,"sourceCode":"\n\tfieldExpression, err := m.FieldFor(ctx, orgID, startNs, endNs, field)\n\tif errors.Is(err, qbtypes.ErrColumnNotFound) {\n\t\t// the key didn't have the right context to be added to the query\n\t\t// we try to use the context we know of\n\t\tkeysForField := keys[field.Name]\n\t\tif len(keysForField) == 0 {\n\t\t\t// is it a static field?\n\t\t\tif _, ok := attributeMetadataColumns[field.Name]; ok {\n\t\t\t\t// if it is, attach the column name directly\n\t\t\t\tfield.FieldContext = telemetrytypes.FieldContextSpan\n\t\t\t\tfieldExpression, _ = m.FieldFor(ctx, orgID, startNs, endNs, field)\n\t\t\t} else {\n\t\t\t\t// - the context is not provided\n\t\t\t\t// - there are not keys for the field\n\t\t\t\t// - it is not a static field\n\t\t\t\t// - the next best thing to do is see if there is a typo\n\t\t\t\t// and suggest a correction\n\t\t\t\twrappedErr := errors.Wrapf(err, errors.TypeInvalidInput, errors.CodeInvalidInput, \"field `%s` not found\", field.Name).WithSuggestions(errors.NewSuggestionsOnLevenshteinDistance(field.Name, errors.NounKeys, maps.Keys(keys))...)\n\t\t\t\treturn \"\", wrappedErr\n\t\t\t}\n\t\t} else if len(keysForField) == 1 {\n\t\t\t// we have a single key for the field, use it\n\t\t\tfieldExpression, _ = m.FieldFor(ctx, orgID, startNs, endNs, keysForField[0])\n\t\t} else {\n\t\t\t// select any non-empty value from the keys\n\t\t\targs := []string{}\n\t\t\tfor _, key := range keysForField {\n\t\t\t\tfieldExpression, _ = m.FieldFor(ctx, orgID, startNs, endNs, key)\n\t\t\t\targs = append(args, fmt.Sprintf(\"toString(%s) != '', toString(%s)\", fieldExpression, fieldExpression))\n\t\t\t}\n\t\t\tfieldExpression = fmt.Sprintf(\"multiIf(%s, NULL)\", strings.Join(args, \", \"))\n\t\t}\n\t}\n\n\treturn fmt.Sprintf(\"%s AS `%s`\", sqlbuilder.Escape(fieldExpression), field.Name), nil\n}","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/telemetrymetadata/field_mapper.go#L98-L134","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the attached suggestions (Levenshtein matches) and use the suggested field name","List available keys first via GetKeys/GetKeysMulti for the same signal, org, and time range, and pick the exact name","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","If the field was renamed, update the caller to the new name or add an alias"],"exampleFix":"// before\nexpr, err := mapper.ColumnExpressionFor(ctx, orgID, startNs, endNs, telemetrytypes.Field{Name: \"servicName\"})\n\n// after\n// inspect err suggestions, then:\nexpr, err := mapper.ColumnExpressionFor(ctx, orgID, startNs, endNs, telemetrytypes.Field{Name: \"serviceName\"})","handlingStrategy":"validation","validationCode":"// Fetch known keys first and check the field name before mapping\nkeys, _, err := meta.GetKeys(ctx, orgID, signal, startNs, endNs, telemetrytypes.FieldSelector{})\nif err != nil { return err }\nknown := make(map[string]struct{}, len(keys))\nfor _, k := range keys { known[k.Name] = struct{}{} }\nif _, ok := known[field.Name]; !ok {\n    return fmt.Errorf(\"unknown field %q; check available keys\", field.Name)\n}","typeGuard":"func isKnownField(field string, keys []*telemetrytypes.TelemetryFieldKey) bool {\n    for _, k := range keys {\n        if k.Name == field { return true }\n    }\n    return false\n}","tryCatchPattern":"// After calling ColumnExpressionFor:\nif err != nil {\n    if e, ok := err.(*errors.Error); ok && e.Code == errors.CodeInvalidInput {\n        for _, s := range e.Suggestions() { /* offer correction to user */ }\n    }\n    return err\n}","preventionTips":["Validate field names against GetKeys output before building expressions","Surface suggestions from the error to end users as did-you-mean prompts","Add autocomplete for field names in your UI to prevent typos","Pin field-name lists per signal and test after schema renames"],"tags":["invalid-input","field-not-found","typo","metadata"],"backgroundTag":"unknown-field-name","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}