# 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](/developer-guides/error-messages/0151-to-0179/aur0153.md) - Expected identifier
* [AUR0168](/developer-guides/error-messages/0151-to-0179/aur0168.md) - Unexpected character
* [AUR0155](/developer-guides/error-messages/0151-to-0179/aur0155.md) - Unexpected end of expression


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aurelia.io/developer-guides/error-messages/0151-to-0179/aur0151.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
