# `PtcRunner.Lisp.Prelude.ValidationError`
[🔗](https://github.com/andreasronge/ptc_runner/blob/main/lib/ptc_runner/lisp/prelude/validation_error.ex#L1)

Compile-time validation failure for a deployment prelude (Capability
Prelude V1, plan §3 / §10).

Returned as `{:error, %ValidationError{}}` from
`PtcRunner.Lisp.Prelude.Compiler.compile/1` when the prelude SOURCE is
malformed in a way that does not depend on a selected runtime (parse
errors, reserved-namespace declarations, duplicate refs, bad visibility,
invalid arity/signature metadata, and similar facts), and from
`PtcRunner.Lisp.Prelude.Attach.validate_requires/2` with the
`:prelude_attach_failed` reason when a public export `requires` an upstream
operation the selected runtime does not provide (plan §3 / §6A).

## Fields

  * `reason` — a stable, matchable atom. Compile-time reasons:
    `:reserved_namespace`, `:reserved_name`, `:duplicate_ref`,
    `:invalid_visibility`, `:invalid_requires`, `:invalid_metadata`,
    `:qualified_self_reference`, `:missing_namespace`, `:invalid_namespace`,
    `:invalid_signature`, `:parse_error`, `:compile_error`. Attach-time
    reason: `:prelude_attach_failed`.
  * `message` — human-readable detail naming the offending namespace,
    symbol, or value. Must not contain secrets (plan §12).
  * `namespace` — the declaring namespace when known, else `nil`.
  * `ref` — the offending export ref when known, else `nil`.

# `reason`

```elixir
@type reason() ::
  :reserved_namespace
  | :reserved_name
  | :duplicate_ref
  | :invalid_visibility
  | :invalid_requires
  | :invalid_metadata
  | :qualified_self_reference
  | :missing_namespace
  | :invalid_namespace
  | :invalid_signature
  | :parse_error
  | :compile_error
  | :unrecognized_node
  | :prelude_attach_failed
```

# `t`

```elixir
@type t() :: %PtcRunner.Lisp.Prelude.ValidationError{
  message: String.t(),
  namespace: String.t() | nil,
  reason: reason(),
  ref: String.t() | nil
}
```

# `new`

```elixir
@spec new(reason(), String.t(), keyword()) :: t()
```

Builds a validation error.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
