# error Definition
**Definition:** Throw an HTTP error from `load`/actions/`+server`
handlers.
**Syntax (Kit 2+):** `throw error(status, messageOrBody)`
Important:
- You must `throw error(...)` — do not call it without throwing.
- Use inside server/universal `load`, actions, and `+server` handlers.
## Example
```ts
import { error } from '@sveltejs/kit';
if (!item) throw error(404, 'Not found');
```
## Related
- `redirect`, `json`
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/spences10/mcp-svelte-docs'
If you have feedback or need assistance with the MCP directory API, please join our Discord server