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

# Troubleshoot Sectioning

export const adePythonLibrary = 'ade-python';

export const section = 'ADE Section';

export const parse = 'ADE Parse';

export const ade = 'Agentic Document Extraction';

Use this section to troubleshoot issues encountered when calling the [{section}](https://docs.landing.ai/api-reference/tools/ade-section) API ([https://api.va.landing.ai/v1/ade/section](https://api.va.landing.ai/v1/ade/section)).

## Status Codes

| Status Code | Name                  | Description                                                       | What to Do                                                                                                                                  |
| ----------- | --------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| 200         | Success               | Sectioning completed successfully.                                | Continue with normal operations.                                                                                                            |
| 400         | Bad Request           | Invalid request due to Markdown download failure from URL.        | Review error message for specific issue. See [Status 400](#status-400-bad-request).                                                         |
| 401         | Unauthorized          | Missing or invalid API key.                                       | Check that your `Authorization` header is present and contains a valid [API key](./agentic-api-key).                                        |
| 402         | Payment Required      | Your account does not have enough credits to complete processing. | If you have multiple accounts, make sure you're using the correct [API key](./agentic-api-key). Add more credits to your account.           |
| 422         | Unprocessable Entity  | Input validation failed.                                          | Review your request parameters. See [Status 422](#status-422-unprocessable-entity).                                                         |
| 429         | Too Many Requests     | Rate limit exceeded.                                              | Wait before retrying. Reduce request frequency and implement exponential backoff.                                                           |
| 500         | Internal Server Error | Server error during sectioning.                                   | Retry. If the issue persists, contact [support@landing.ai](mailto:support@landing.ai). See [Status 500](#status-500-internal-server-error). |
| 504         | Gateway Timeout       | Request processing exceeded the timeout limit.                    | Reduce Markdown content size. See [Status 504](#status-504-gateway-timeout).                                                                |

## Status 400: Bad Request

This status code indicates a client-side error. Review the specific error message to identify the issue.

### Error: Failed to download document from URL

This error occurs when the API cannot download the Markdown file from the provided `markdown_url`.

**Error message:**

```
Failed to download document from URL: {error_details}
```

**What to do:**

* Verify the URL is accessible and returns valid content.
* Check network connectivity and URL permissions.
* Ensure the URL points to a Markdown file (.md extension).

## Status 422: Unprocessable Entity

This status code indicates input validation failures. Review the error message and adjust your request parameters.

### Error: No markdown provided

This error occurs when your request does not include the `markdown` parameter or `markdown_url` parameter, or when the values are empty.

**Error message:**

```
Must provide either 'markdown' or 'markdown_url'.
```

**What to do:**

Add one of these parameters to your request:

* Use the `markdown` parameter to upload a Markdown file or provide inline Markdown content, OR
* Use the `markdown_url` parameter to provide a URL to a Markdown file.

### Error: Both 'markdown' and 'markdown\_url' provided

This error occurs when your request includes both the `markdown` and `markdown_url` parameters.

**Error message:**

```
Cannot provide both 'markdown' and 'markdown_url'.
```

**What to do:**

Remove one of the parameters. Use either `markdown` (to upload a file or provide inline content) or `markdown_url` (to specify a URL), but not both in the same request.

### Error: Invalid 'markdown\_url' format

This error occurs when the value provided for `markdown_url` is not a valid URL.

**Error message:**

```
Invalid URL format: {url}
```

**What to do:**

* Verify that the URL is correctly formatted (for example, `https://example.com/document.md`).
* Ensure the URL includes a scheme (`https://` or `http://`).

### Error: Multiple markdown files detected

This error occurs when multiple Markdown files are included in the request.

**Error message:**

```
Multiple markdown files detected (X). Please provide only one document file.
```

**What to do:**

Send only one Markdown file per request.

### Error: Unsupported format

This error occurs when you provide a file other than Markdown (.md) to the section endpoint.

**Error message:**

```
Unsupported format: {mime_type} ({filename}). Supported formats: MD
```

**What to do:**

* The section endpoint only accepts Markdown files with a .md extension.
* If you have a PDF, DOCX, or other document format, use the [{parse} API](https://docs.landing.ai/api-reference/tools/ade-parse) to convert your document to Markdown first, then pass the parsed Markdown output to the section endpoint.
* Ensure your file has a .md extension and contains valid UTF-8 encoded Markdown content.

### Error: Missing reference anchors

This error occurs when the Markdown content does not contain reference anchors. The section endpoint requires Markdown output from the [{parse} API](https://docs.landing.ai/api-reference/tools/ade-parse), which includes `<a id="..."></a>` anchors that {section} uses to map sections to chunks.

**Error message:**

```
Invalid markdown: missing reference anchors. Markdown must contain <a id="..."></a> reference delimiters. Use the parse tool to generate properly formatted markdown.
```

**What to do:**

* Do not pass plain Markdown or documents you have formatted manually. Use the Markdown output from the [{parse} API](https://docs.landing.ai/api-reference/tools/ade-parse) as input.
* Confirm the Markdown content contains `<a id="..."></a>` anchor tags before sending it to the section endpoint.

## Status 500: Internal Server Error

This error indicates an unexpected server error occurred during sectioning.

**What to do:**

* Retry the request.
* If the error persists, contact [support@landing.ai](mailto:support@landing.ai).

## Status 504: Gateway Timeout

This error occurs when the sectioning process exceeds the timeout limit.

**What to do:**

* Reduce the size of your Markdown document.
* If the error persists, contact [support@landing.ai](mailto:support@landing.ai).

## Best Practices for Avoiding Errors

* **Use parsed Markdown**: Always pass Markdown content generated by the [{parse} API](./ade-separate-apis). The section endpoint requires structured Markdown with [reference anchors](./ade-markdown-response#anchor-tags) (`<a id="..."></a>`).
* **Use guidelines sparingly**: The `guidelines` parameter is optional. Start without guidelines to see the default behavior before customizing the hierarchy.

## When Are Credits Consumed?

Credits are consumed only when the {section} API returns a 200 status code. All other responses, including errors, do not consume credits.
