# V8030 dependency_invalid

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

> An entry of [dependencies] in sakura.toml is malformed (RFC 0003 §1.2, experimental).

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

An entry of `[dependencies]` in `sakura.toml` is malformed (RFC 0003 §1.2, experimental).
An entry is `name = "MAJOR.MINOR.PATCH"`, `name = { version = "…" }`, `name = { path =
"\<relative dir\>" \}` or `name = \{ git = "\<https URL\>", rev = "\<40 hex\>" \}`, each optionally
with `effects = [...]` and `trusted = true`. The message names the cause: a name that is not
`[a-z][a-z0-9_]*` or is `std` or `main`; a floor that is not three numbers (no `*`, ranges,
pre-release or build metadata); both `version` and `path`; a `path` that is absolute; a `git`
without `rev`, or a `rev` that is not a full 40-hex commit hash (a branch or tag is refused); an
unknown key; a value of the wrong type; or a `path` dependency whose own `sakura.toml` names it
differently from its key.

Wrong:

```toml
[dependencies]
util = "*"
```

Fixed:

```toml
[dependencies]
util = { path = "../util" }
```

## Wrong program [#wrong-program]

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

`main.sak`:

```sakura
// RFC 0003 §1.2: each malformed `[dependencies]` entry is `V8030` at the entry, naming its
// `MAJOR.MINOR.PATCH`, both `version` and `path`, an absolute `path`, `git` without `rev`, a
// `rev` that is not a full commit hash, and an unknown key (a branch).
pub fn main() -> Unit ! {Console} { Console.print("hi") }
```

`sakura.toml`:

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

[dependencies]
Http = "1.0.0"
std = "1.0.0"
json = "*"
util = { version = "1.0.0", path = "../util" }
abs = { path = "/opt/abs" }
scraper = { git = "https://github.com/acme/scraper" }
parser = { git = "https://github.com/acme/parser", rev = "main" }
lexer = { git = "https://github.com/acme/lexer", branch = "main" }
```

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

```json
{
  "schema_version": "1.0",
  "kind": "diagnostic",
  "id": "d:ec99ae345000f041",
  "code": "V8030",
  "severity": "error",
  "phase": "package",
  "message": "`Http` is not a package name: lowercase letters, digits and `_`, starting with a letter",
  "snapshot": "sha256:$SNAPSHOT",
  "symbol_id": null,
  "spans": [
    {
      "uri": "file://$DIR/V8030_dependency_invalid/sakura.toml",
      "content_hash": "sha256:b9c24d228819dea3e00c30ad646a86ff3c260dfe4bf0057a938b6860657f8e88",
      "start_byte": 43,
      "end_byte": 57,
      "role": "primary"
    }
  ],
  "related_ids": [],
  "expected": null,
  "actual": null,
  "obligation": null,
  "counterexample": null,
  "explanation_uri": "sakura://explain/V8030",
  "fixes": []
}
```

## Fixed program [#fixed-program]

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