SigNoz/signoz · error · errors.base

invalid_input

invalid_input

Error message

error updating existing filter

What it means

UpdateQuickFilters found an existing stored filter for the (org, signal) pair and called existingFilter.Update(filterJSON), which validates the marshalled JSON against the storable filter's invariants (e.g. payload shape). A validation failure is wrapped as invalid_input with 'error updating existing filter'.

Source

Thrown at pkg/modules/quickfilter/implquickfilter/module.go:90

	}

	// Marshal filters to JSON
	filterJSON, err := json.Marshal(filters)
	if err != nil {
		return errors.Wrapf(err, errors.TypeInternal, errors.CodeInternal, "error marshalling filters")
	}

	// Check if filter exists
	existingFilter, err := module.store.GetBySignal(ctx, orgID, signal.StringValue())
	if err != nil {
		return errors.Wrapf(err, errors.TypeInternal, errors.CodeInternal, "error checking existing filters")
	}

	var filter *quickfiltertypes.StorableQuickFilter
	if existingFilter != nil {
		// Update in place
		if err := existingFilter.Update(filterJSON); err != nil {
			return errors.Wrapf(err, errors.TypeInvalidInput, errors.CodeInvalidInput, "error updating existing filter")
		}
		filter = existingFilter
	} else {
		// Create new
		filter, err = quickfiltertypes.NewStorableQuickFilter(orgID, signal, filterJSON)
		if err != nil {
			return errors.Wrapf(err, errors.TypeInvalidInput, errors.CodeInvalidInput, "error creating new filter")
		}
	}

	// Persist filter
	if err := module.store.Upsert(ctx, filter); err != nil {
		return err
	}

	return nil
}

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Compare your request body shape with the one the UI sends for the same signal (envelope, keys, types)
  2. Check the wrapped underlying error for the specific validation message from Update
  3. Update to matching client/server versions if the filter schema changed
  4. If the stored row is stale/corrupt, delete it so the next update takes the create path
Defensive patterns

Strategy: validation

Validate before calling

// Mirror the shape the UI sends; verify against an existing GET response
const existing = await getSignalFilters(orgId, signal);
assert(filters.every(f => typeof f.key === 'string' && typeof f.value !== 'undefined'));
await updateQuickFilters(orgId, signal, filters);

Type guard

function isFilterPayload(f: unknown): f is { key: string; value: unknown; op?: string } {
  return typeof f === 'object' && f !== null && typeof (f as any).key === 'string' && 'value' in (f as any);
}

Try / catch

try { await updateQuickFilters(orgId, signal, filters); } catch (e) { if (e.code === 'invalid_input' && /updating existing/i.test(e.message)) { showValidationError(e.cause?.message); } else throw e; }

Prevention

When it happens

Trigger: PUT/POST quick filters for a signal that already has stored filters, where the new filter JSON fails StorableQuickFilter.Update's checks — wrong envelope shape, unknown keys, or size/format constraints.

Common situations: Client sending a filter payload shape that differs from what the existing row's format expects (version drift between UI and server), or a payload that violates update invariants.

Related errors


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