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

# Troubleshooting

> Find steps to troubleshoot common issues while running the SAP extractor.

## Common connectivity issues

Before starting the extraction routines, the SAP extractor performs a connection check to all configured endpoints.

### ConnectTimeout

```

requests.exceptions.ConnectTimeout: HTTPConnectionPool(host=gateway_url, port=port): Max retries exceeded with url: /sap/opu/odata/sap/YOURSERVICE

```

This error occurs when the SAP extractor can't reach the configured SAP gateway, and the connection ends in a timeout.
To solve this error, make sure the extractor can access the SAP OData gateway instance, for instance via the firewall, VPN, or SAP WebDispatcher.

### 401 Logon Failed

```

RuntimeError: Could not connect to SAP Gateway https://yourgatewayurl : Status Code 401 Logon failed

```

This error occurs when the extractor can't authenticate to SAP. Review the `client`, `username`, and `password` configuration parameters.

### 403 No service found

```

RuntimeError: Could not connect to SAP Gateway https://yourgatewayurl: Status Code 403 No service found for namespace '', name 'YOURSERVICE', version '0001'

```

This error occurs when the endpoint configured doesn't exist in SAP. Review the configuration in the `endpoints` section.

### 403 Access Denied

```

RuntimeError: Could not connect to SAP Gateway: 403 Access Denied

```

This error occurs when an SAP user doesn't have access in the SAP system to fetch data from the configured endpoint. The SAP server administrator must grant the access.

### SSL certificate verification failed

```

requests.exceptions.SSLError: HTTPSConnectionPool(host='yourgatewayurl', port=443): Max retries exceeded with url: /sap/opu/odata/sap/YOURSERVICE (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate')))

```

This error occurs when the VM hosting the extractor can't validate the SAP system's server certificate during the HTTPS connection. This may be because the SAP endpoint uses a self-signed or internally issued certificate that isn't present in the VM's trusted certificate store. See [Secure SAP connections with self-signed certificates](/cdf/integration/guides/extraction/sap/sap_setup#secure-sap-connections-with-self-signed-certificates).

## Common data extraction issues

### AttributeError: Entityset XXX not defined

```

AttributeError: EntitySet <yourentityname> not defined in <entityA>,<entityB> ...

```

This error occurs when the configuration parameter `sap-entity` for the related endpoint configuration is incorrect. You must use a valid entity name.

### Maximum string length Error (OData endpoint)

```
/IWND/COM_CONSUMER122 Maximum stringh length (2,145,386,496 bytes) exceeded
```

This is a limitation in SAP OData endpoint related to the size of the OData object in the response. This error is likely to happen when running the extractor in full load mode (`incremental-field` is not configured).

### Extractor might enter in a "loop" state when using `incremental-field` (Custom OData endpoints)

The SAP extractor uses OData $skip and $top operations to handle pagination. When setting up the SAP extractor towards a custom SAP OData endpoint, make sure that your SAP implementation supports pagination.

### Extractor fails with error message "Incremental field is not valid" (OData endpoint)

The SAP extractor validates whether the `incremental-field` set in the endpoint configuration is a valid `Edm.DateTimeOffset` field.
This is required to perform incremental loads with pagination towards SAP.

### State store timestamp does not advance (OData endpoint)

This issue occurs when the state store holds an old timestamp after each extractor run. The OData service returns records in descending order by the `incremental-field` instead of ascending, so the SAP extractor writes the oldest timestamp from the last processed row to the state store. Each subsequent run re-fetches data from that old date and places extra load on the SAP server.

To solve this issue, ensure records are returned in ascending order by the `incremental-field`:

* **Custom OData endpoints:** Configure the endpoint to return records in ascending order.
* **Standard S/4HANA OData services:** Work with your SAP administrator to update the service implementation.

See [Load data incrementally](/cdf/integration/guides/extraction/sap/sap_setup#load-data-incrementally-odata-only) for more information.
