# V0004 invalid_character

URL: /docs/errors/V0004
Markdown: /docs/errors/V0004.md

> The source contains a character that cannot start any token.

An error from the `lex` phase. `sakura explain V0004` prints this explanation offline.

The source contains a character that cannot start any token. Remove it, or put it inside a string.

Wrong:

```sakura
fn price() -> Int { 1 $ 2 }
```

Fixed:

```sakura
fn price() -> Int { 1 + 2 }
```

## Wrong program [#wrong-program]

[`compiler/tests/ui/V0004_invalid_character.sakura`](https://github.com/icantcodefyi/sakuralang/blob/master/compiler/tests/ui/V0004_invalid_character.sakura), which the compiler's ui suite runs through `sakura check`:

```sakura
fn price() -> Int { 1 $ 2 }
```

`sakura check --json` reports this record (pretty-printed; `$DIR` is the fixture's directory):

```json
{
  "schema_version": "1.0",
  "kind": "diagnostic",
  "id": "d:c4891f640c5e538f",
  "code": "V0004",
  "severity": "error",
  "phase": "lex",
  "message": "unexpected character `$`",
  "snapshot": "sha256:$SNAPSHOT",
  "symbol_id": "main::V0004_invalid_character::price",
  "spans": [
    {
      "uri": "file://$DIR/V0004_invalid_character.sakura",
      "content_hash": "sha256:7f1f0ceccb34c4fd667b6e3de781ca528e3486cb76e3981f65310a9c99a3fbdb",
      "start_byte": 56,
      "end_byte": 57,
      "role": "primary"
    }
  ],
  "related_ids": [],
  "expected": null,
  "actual": null,
  "obligation": null,
  "counterexample": null,
  "explanation_uri": "sakura://explain/V0004",
  "fixes": []
}
```

## Fixed program [#fixed-program]

[`compiler/tests/ui/V0004_invalid_character.fixed.sakura`](https://github.com/icantcodefyi/sakuralang/blob/master/compiler/tests/ui/V0004_invalid_character.fixed.sakura), which `sakura check` accepts with no diagnostics:

```sakura
fn price() -> Int { 1 + 2 }
```
