Version: EdgeVec v0.7.0 Last Updated: 2025-12-29
| Range | Category | Description |
|---|---|---|
E001-E099 |
Syntax Errors | Parse errors, invalid tokens |
E101-E199 |
Type Errors | Type mismatches, invalid casts |
E201-E299 |
Evaluation Errors | Runtime evaluation errors |
E301-E399 |
Limit Errors | Resource limits exceeded |
E401-E499 |
Strategy Errors | Filter strategy configuration |
Cause: General syntax error during parsing.
Example:
category gpu // Missing operator
Fix: Add the missing operator:
category = "gpu"
Position Info: Yes (position, line, column)
Cause: Unexpected end of input while parsing.
Example:
category = // Value expected
Fix: Complete the expression:
category = "gpu"
Position Info: Yes (position)
Cause: Invalid character encountered during parsing.
Example:
category @ "gpu" // '@' is not valid
Fix: Use valid operators (=, !=, <, >, etc.):
category = "gpu"
Position Info: Yes (character, position)
Cause: String literal started but never closed.
Example:
category = "gpu // Missing closing quote
Fix: Close the string:
category = "gpu"
Suggestion: "Did you forget the closing quote?"
Position Info: Yes (position where string started)
Cause: Opening parenthesis without matching close.
Example:
(a = 1 AND b = 2 // Missing )
Fix: Close the parenthesis:
(a = 1 AND b = 2)
Suggestion: "Did you forget the closing parenthesis?"
Position Info: Yes (position of opening paren)
Cause: Invalid escape sequence in string.
Example:
name = "test\xvalue" // \x is not valid
Fix: Use valid escape sequences:
name = "test\\xvalue" // Escaped backslash
Valid Escapes: \", \\, \n, \r, \t
Position Info: Yes (position of backslash)
Cause: Malformed number literal.
Example:
price = 1.2.3 // Multiple decimal points
Fix: Use valid number format:
price = 1.23
Position Info: Yes (position where number started)
Cause: Operation with incompatible types.
Example:
// Field 'count' is integer, but compared with string
count = "five"
Fix: Use matching type:
count = 5
Suggestion: "Field 'count' is of type 'integer', but 'string' was expected. Check that you're using the right operator for this field type."
Cause: Two values of incompatible types were compared.
Example:
// Can't compare string with integer
category = 123
Fix: Use compatible types:
category = "123" // String comparison
// OR
count = 123 // Integer comparison
Cause: Operator used with unsupported type.
Example:
// Can't use < with boolean
active < true
Fix: Use valid operator for type:
active = true // Boolean equality
Cause: Field referenced that doesn't exist.
Example:
categry = "gpu" // Typo: should be "category"
Fix: Correct the field name:
category = "gpu"
Suggestion: "Field 'categry' does not exist. Check the field name for typos."
Cause: Division by zero during evaluation.
Note: This error is rare in filter expressions as division is not commonly used.
Cause: Null value in non-nullable context.
Example:
// Field 'description' is null, but comparison requires a value
description > "test"
Fix: Check for null first:
description IS NOT NULL AND description > "test"
Cause: Array index out of bounds.
Note: This error is rare in filter expressions.
Cause: Literal used where boolean expression expected.
Example:
// Just a value, not a boolean expression
"gpu"
Fix: Use a complete comparison:
category = "gpu"
Cause: Expression exceeds maximum nesting depth (50 levels).
Example:
(((((... 51 levels ...)))))
Fix: Simplify the expression by:
- Splitting into multiple queries
- Reducing redundant grouping
- Combining conditions
Suggestion: "Simplify your filter expression. Maximum nesting depth is 50."
Limits:
- Max depth: 50 levels
Cause: Expression has too many nodes/operations (>1000).
Example:
a = 1 AND b = 2 AND c = 3 AND ... (1001 conditions)
Fix: Break into multiple queries or use IN operator:
// Instead of many OR conditions:
id IN [1, 2, 3, 4, 5, ...]
Limits:
- Max nodes: 1,000
Cause: Filter expression string exceeds maximum length.
Example:
// Filter string > 65,536 bytes
Fix: Shorten the expression or use parameterized queries.
Limits:
- Max length: 65,536 bytes
Cause: Array literal in IN/ANY/ALL has too many elements.
Example:
id IN [1, 2, 3, ..., 1001] // Too many elements
Fix: Reduce array size or use multiple queries:
// Split into chunks
id IN [1, 2, ..., 500] // First query
id IN [501, 502, ..., 1000] // Second query
Suggestion: "Use smaller arrays in IN/ANY/ALL operators. Maximum is 1000 elements."
Limits:
- Max elements: 1,000
Cause: Invalid filter strategy configuration.
Example:
{
"strategy": "invalid",
"oversampleFactor": 0.5 // Must be >= 1.0
}Fix: Use valid strategy and parameters:
{
"strategy": "auto",
"oversampleFactor": 3.0
}Valid Strategies: auto, pre, post, hybrid
import { parse_filter_js, validate_filter_js } from 'edgevec';
// Method 1: Try-catch
try {
const ast = parse_filter_js('category = "gpu"');
} catch (e) {
const error = JSON.parse(e);
console.log('Code:', error.code);
console.log('Message:', error.message);
console.log('Position:', error.position);
console.log('Suggestion:', error.suggestion);
}
// Method 2: Validate first
const result = JSON.parse(validate_filter_js(userInput));
if (!result.valid) {
console.log('Errors:', result.errors);
console.log('Warnings:', result.warnings);
}interface FilterError {
code: string; // "E001", "E301", etc.
message: string; // Human-readable message
position?: number; // Byte offset (for syntax errors)
line?: number; // Line number (1-indexed)
column?: number; // Column number (1-indexed)
suggestion?: string; // Fix suggestion
}-
Validate before use:
const validation = JSON.parse(validate_filter_js(userInput)); if (validation.valid) { // Safe to use }
-
Quote all string values:
// Good 'category = "gpu"' // Bad - will cause E001 'category = gpu'
-
Use parentheses for clarity:
// Good '(a = 1 OR b = 2) AND c = 3' // Ambiguous 'a = 1 OR b = 2 AND c = 3'
-
Keep arrays small:
// Good (< 1000 elements) 'id IN [1, 2, 3, 4, 5]' // Bad - may cause E304 'id IN [1, 2, ..., 2000]'
-
Avoid deep nesting:
// Good (flat structure) 'a = 1 AND b = 2 AND c = 3' // Avoid (unnecessary nesting) '(((a = 1) AND (b = 2)) AND (c = 3))'