# V0002 unterminated

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

> A string literal, interpolation or block comment reaches the end of the file without being closed.

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

A string literal, interpolation or block comment reaches the end of the file without being
closed.

Wrong:

```sakura
let s = "hello
```

Fixed:

```sakura
let s = "hello"
```

## Wrong program [#wrong-program]

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

```sakura
fn one() -> Int { 1 }
/* this comment never closes
```

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

```json
{
  "schema_version": "1.0",
  "kind": "diagnostic",
  "id": "d:314d98857730bb67",
  "code": "V0002",
  "severity": "error",
  "phase": "lex",
  "message": "unterminated block comment",
  "snapshot": "sha256:$SNAPSHOT",
  "symbol_id": null,
  "spans": [
    {
      "uri": "file://$DIR/V0002_unterminated_block_comment.sakura",
      "content_hash": "sha256:07a72a6fce2707973062936a0e1963fa5edbb2e766238d9f06335da6403199f7",
      "start_byte": 56,
      "end_byte": 85,
      "role": "primary"
    }
  ],
  "related_ids": [],
  "expected": null,
  "actual": null,
  "obligation": null,
  "counterexample": null,
  "explanation_uri": "sakura://explain/V0002",
  "fixes": []
}
```

## Fixed program [#fixed-program]

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

```sakura
fn one() -> Int { 1 }

/* this comment is closed */
```
