# Validation

Every issue has a JSON Pointer path, a message and a suggested fix, often a ready patch.

Motion SDK checks a scene in two passes: the shape (types, unknown fields, ranges) and the meaning (references, cycles, keyframe order, loop seams, export limits). Every problem comes back as an issue an agent can act on.

```json
{
  "severity": "error",
  "code": "unknown_field",
  "path": "/nodes/orb/transform/postion",
  "message": "unknown field `postion`, expected one of `position`, `rotation`, `scale`",
  "suggested_fix": "did you mean `position`? rename the key: {\"op\":\"move\",\"from\":\"/nodes/orb/transform/postion\",\"path\":\"/nodes/orb/transform/position\"}"
}
```

| Field | Meaning |
| --- | --- |
| `severity` | `error`: the scene can't render as written. `warning`: it renders, but probably not as you meant. |
| `code` | A stable code. See [Error Codes](/docs/reference/errors). |
| `path` | A JSON Pointer to the field. |
| `message` | What's wrong, in a sentence. |
| `suggested_fix` | What to do, often with a patch you can apply as is. |

## Validate

```bash
motion-sdk validate scene.json          # streaming mode
motion-sdk validate scene.json --final  # finished document
motion-sdk validate scene.json --json   # the machine-readable report
```

```rust
use motion_sdk_spec::{validate_str, Mode};

let result = validate_str(r#"{"nodes":{"orb":{"transform":{"postion":[0,1,0]}}}}"#, Mode::Final);
let issue = &result.report.issues[0];
assert_eq!(issue.path, "/nodes/orb/transform/postion");
assert!(issue.suggested_fix.contains("did you mean `position`"));
```

## Modes

- **Streaming** (default): dangling references, like a material that isn't written yet, are warnings. Use it while an agent is still sending patches.
- **Final**: dangling references are errors. Use it when the scene is done, and before you export.

## The Loop

1. Validate.
2. Apply each `suggested_fix`.
3. Validate again until there are no errors.
4. Read the warnings. They catch things like loops that visibly jump, cuts between frames and lights that never turn on.

The validator also catches hierarchy cycles, unsorted keyframes, wrong value types, unreachable states, odd video sizes and each platform's duration cap. The full list, with the fix for each, is in [Error Codes](/docs/reference/errors).
