> ## Documentation Index
> Fetch the complete documentation index at: https://docs.formbase.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Error Handling

> Handle upload errors gracefully.

File uploads can fail for the same reasons as any submission: invalid form ID, storage misconfiguration, or network issues. The Formbase submit endpoint responds with standard HTTP status codes so you can handle errors in your UI.

Here is a simple client-side pattern you can reuse.

```js theme={null}
const response = await fetch('https://formbase.dev/s/YOUR_FORM_ID', {
  method: 'POST',
  body: new FormData(formElement),
  redirect: 'manual',
});

if (response.status === 303 || response.ok) {
  // Success
} else if (response.status === 404) {
  // Form not found
} else {
  // General failure (500 or other)
}
```

## Common error causes

<AccordionGroup>
  <Accordion icon="triangle-exclamation" title="Storage not configured">
    Formbase throws an error if storage credentials are missing when a file is uploaded. Ensure all `STORAGE_*` environment variables are set.
  </Accordion>

  <Accordion icon="link" title="Incorrect form ID">
    A `404` response means the form ID does not exist or is not available in this Formbase instance.
  </Accordion>

  <Accordion icon="wifi" title="Network failures">
    Handle timeouts or offline conditions by showing a retry button and preserving form state when possible.
  </Accordion>
</AccordionGroup>

<Callout type="note">
  Browser submissions return a `303` redirect on success. Treat `303` as a successful upload.
</Callout>
