# AUR0151

## Error Message

`AUR0151: Expression error: invalid start: "{{expression}}"`

Where `{{expression}}` is the problematic binding expression.

## Description

This error occurs when a binding expression starts with an invalid token or character that the expression parser cannot process. The Aurelia expression parser expects expressions to begin with valid JavaScript-like syntax.

## Common Scenarios

### Invalid Starting Characters

```html
<!-- ❌ Wrong: Starting with invalid characters -->
<div textcontent.bind="@invalid"></div>
<div textcontent.bind="#invalid"></div>
<div textcontent.bind="$invalid"></div>
```

### Malformed Property Access

```html
<!-- ❌ Wrong: Starting with dot -->
<div textcontent.bind=".property"></div>

<!-- ❌ Wrong: Starting with bracket -->
<div textcontent.bind="[0]"></div>
```

### Invalid Operators at Start

```html
<!-- ❌ Wrong: Starting with operators -->
<div textcontent.bind="+ value"></div>
<div textcontent.bind="* multiplier"></div>
<div textcontent.bind="&& condition"></div>
```

## Solutions

### 1. **Fix Property Access**

```html
<!-- ✅ Correct: Proper property access -->
<div textcontent.bind="item.property"></div>
<div textcontent.bind="items[0]"></div>
<div textcontent.bind="this.property"></div>
```

### 2. **Use Valid Variable Names**

```html
<!-- ✅ Correct: Valid identifiers -->
<div textcontent.bind="userName"></div>
<div textcontent.bind="_privateValue"></div>
<div textcontent.bind="$specialValue"></div> <!-- $ is valid at start -->
```

### 3. **Proper Expression Syntax**

```html
<!-- ✅ Correct: Valid expressions -->
<div textcontent.bind="value + 1"></div>
<div textcontent.bind="condition && result"></div>
<div textcontent.bind="(expression)"></div>
```

### 4. **Handle Special Cases**

```html
<!-- ✅ Correct: Literal values -->
<div textcontent.bind="'string literal'"></div>
<div textcontent.bind="42"></div>
<div textcontent.bind="true"></div>

<!-- ✅ Correct: Method calls -->
<div textcontent.bind="getValue()"></div>
<div textcontent.bind="item.toString()"></div>
```

## Example: Common Fixes

```html
<!-- Template with various expression errors -->
<template>
  <!-- ❌ Wrong expressions -->
  <div textcontent.bind="@user"></div>
  <div textcontent.bind=".name"></div>
  <div textcontent.bind="+ 5"></div>
  
  <!-- ✅ Fixed expressions -->
  <div textcontent.bind="user"></div>
  <div textcontent.bind="user.name"></div>
  <div textcontent.bind="value + 5"></div>
  
  <!-- ✅ Alternative approaches -->
  <div textcontent.bind="getUser()"></div>
  <div textcontent.bind="this.name"></div>
  <div textcontent.bind="5"></div>
</template>
```

```typescript
export class MyComponent {
  user = { name: 'John' };
  value = 10;
  
  getUser() {
    return this.user;
  }
}
```

## Debugging Tips

1. **Check Expression Syntax**: Ensure expressions follow JavaScript syntax rules
2. **Validate Property Access**: Use proper dot notation or bracket notation
3. **Check for Typos**: Look for accidental special characters
4. **Use Browser DevTools**: Inspect the element to see the exact binding expression
5. **Test in Console**: Try evaluating similar expressions in browser console

## Related Errors

* [AUR0153](https://github.com/aurelia/aurelia/blob/master/docs/user-docs/developer-guides/error-messages/0151-to-0179/aur0153.md) - Expected identifier
* [AUR0168](https://github.com/aurelia/aurelia/blob/master/docs/user-docs/developer-guides/error-messages/0151-to-0179/aur0168.md) - Unexpected character
* [AUR0155](https://github.com/aurelia/aurelia/blob/master/docs/user-docs/developer-guides/error-messages/0151-to-0179/aur0155.md) - Unexpected end of expression
