# V1011 missing_body

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

> A function has no body.

An error from the `resolve` phase. `sakura explain V1011` prints this explanation offline.

A function has no body. Only `@external` and `@llm` declarations may omit it (design §11.1,
§13.6). Write the body, or leave a typed hole (`{ ?todo }`) that `sakura check` accepts and
reports with its expected type.

Wrong:

```sakura
fn answer() -> Int
```

Fixed:

```sakura
fn answer() -> Int { 42 }
```

## Wrong program [#wrong-program]

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

```sakura
fn answer() -> Int
```

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

```json
{
  "schema_version": "1.0",
  "kind": "diagnostic",
  "id": "d:113646a45572cba8",
  "code": "V1011",
  "severity": "error",
  "phase": "resolve",
  "message": "function `answer` has no body; only `@external` and `@llm` declarations may omit it",
  "snapshot": "sha256:$SNAPSHOT",
  "symbol_id": "main::V1011_missing_body::answer",
  "spans": [
    {
      "uri": "file://$DIR/V1011_missing_body.sakura",
      "content_hash": "sha256:a0934d9e9c56abf72c8033a6645bf7dbffd399f7656e88d39811aa065ea0cffd",
      "start_byte": 63,
      "end_byte": 69,
      "role": "primary"
    }
  ],
  "related_ids": [],
  "expected": null,
  "actual": null,
  "obligation": null,
  "counterexample": null,
  "explanation_uri": "sakura://explain/V1011",
  "fixes": []
}
```

## Fixed program [#fixed-program]

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

```sakura
fn answer() -> Int { 42 }
```
