# V8031 lockfile_invalid

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

> sakura.lock does not describe the dependencies sakura.toml declares, or is not a lock file (RFC 0003 §3, experimental).

An error from the `package` phase. `sakura explain V8031` prints this explanation offline.

`sakura.lock` does not describe the dependencies `sakura.toml` declares, or is not a lock file
(RFC 0003 §3, experimental). The lock is authoritative: `check`, `build`, `run` and `test` load
exactly the packages it lists and never resolve or fetch. The message names the cause: a
dependency added to or removed from the manifest, a version floor above the locked version, a
changed `path`, a changed `trusted`, a dependency whose declared ceiling (`[package] effects`)
changed since it was locked, a lock that is not TOML, or a `version` other than 1 or 2.
`version = 1` is read as a lock with no packages.

The fix is to run `sakura sync`. In this release, which has no `sync` command yet, a project
whose dependencies are all `path` dependencies gets its lock written by the next `sakura check`,
`build`, `run` or `test` when `sakura.lock` is absent or says `version = 1`: delete the lock, or
set it to `version = 1`, to have it rewritten.

## Wrong program [#wrong-program]

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

`main.sak`:

```sakura
// RFC 0003 §3.2, §4.1: a version floor above the locked version is `V8031` at the manifest line.
pub fn main() -> Unit ! {Console} { Console.print("hi") }
```

`sakura.toml`:

```toml
[package]
name = "billing"

[dependencies]
json = "2.1.0"
```

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

```json
{
  "schema_version": "1.0",
  "kind": "diagnostic",
  "id": "d:b427b718c2275185",
  "code": "V8031",
  "severity": "error",
  "phase": "package",
  "message": "sakura.lock is out of date: it has `json` 2.0.3 from `registry+https://registry.sakuralang.com`, which does not satisfy the floor 2.1.0; run `sakura sync`",
  "snapshot": "sha256:$SNAPSHOT",
  "symbol_id": null,
  "spans": [
    {
      "uri": "file://$DIR/V8031_floor_above_lock/sakura.toml",
      "content_hash": "sha256:dc79e09f3a951ab4ddd5f173cec088766749e1fc89a448b05d995b8e6d08e570",
      "start_byte": 43,
      "end_byte": 57,
      "role": "primary"
    }
  ],
  "related_ids": [],
  "expected": null,
  "actual": null,
  "obligation": null,
  "counterexample": null,
  "explanation_uri": "sakura://explain/V8031",
  "fixes": []
}
```

## Fixed program [#fixed-program]

No fixed program is checked in for this code yet; the explanation above describes the repair.
