usememos/memos · error

unsupported value expression

Error message

unsupported value expression

What it means

buildValueExpr is the fallback path for the right-hand side of comparisons: it accepts identifiers (field refs and now), literals, timestamp accessors, size(), and constant-foldable arithmetic. Anything else — a function call, a list, a select expression — falls through to this terminal 'unsupported value expression' error.

Source

Thrown at internal/filter/parser.go:436

			}
			return &FunctionValue{
				Name: "size",
				Args: []ValueExpr{arg},
			}, nil
		case "_+_", "_-_", "_*_":
			value, ok, err := evaluateNumeric(expr, pc.now)
			if err != nil {
				return nil, err
			}
			if ok {
				return &LiteralValue{Value: value}, nil
			}
		default:
			// Fall through to error return below
		}
	}

	return nil, errors.New("unsupported value expression")
}

func toComparisonOperator(fn string) (ComparisonOperator, error) {
	switch fn {
	case "_==_":
		return CompareEq, nil
	case "_!=_":
		return CompareNeq, nil
	case "_<_":
		return CompareLt, nil
	case "_>_":
		return CompareGt, nil
	case "_<=_":
		return CompareLte, nil
	case "_>=_":
		return CompareGte, nil
	default:
		return "", errors.Errorf("unsupported comparison operator %q", fn)

View on GitHub (pinned to 14d757ce1f)

Solutions

  1. Reduce the value side to a literal, field identifier, now, timestamp()/duration() arithmetic, or size()
  2. Use the in operator with a list literal for membership tests instead of comparing against a list
  3. Precompute dynamic values in your code and inline the resulting literal

Example fix

// before
visibility in ["PUBLIC"] && content == "a" + "b"

// after
visibility in ["PUBLIC"] && content == "ab"
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const conditions = compileFilter(filter);
} catch (e) {
  if (String(e).includes('unsupported value expression')) {
    // simplify: right side of comparisons must be literal / field / now / timestamp()/duration() math / size()
    return simplifyFilter(filter);
  }
  throw e;
}

Prevention

When it happens

Trigger: Comparisons whose value side uses an unsupported construct: visibility in ["PUBLIC", "SHARED"] as a raw list without in, created_ts == created_ts + 1 (non-constant arithmetic), or calling an unknown function inside a comparison.

Common situations: Writing CEL that is valid syntax but outside the supported subset — e.g. string concatenation on the right side, ternaries, or custom functions; the filter DSL deliberately supports only a small expression whitelist.

Related errors


AI-assisted analysis of usememos/memos@14d757ce1f (2026-08-15). Data as JSON: /api/errors/10a089afb2148125. Report an issue: GitHub.