Not able to sync because payload is too large (413)

I imported a large amount of history (41k items), but when I go to sync to my self hosted server, I get the following error:

Error: There was an error with the atuin sync service: Status 413.
If the problem persists, contact the host

Location:
    /private/tmp/atuin-20240610-8671-h80ut1/atuin-18.3.0/crates/atuin-client/src/api_client.rs:162:9

Any way to get around this?

After trying again today, it ended up working! So not sure what fixed it.

A 413 tends to occur because a specific history record is too large - the number of history records is not relevant here.

History uploads are batched in groups of around 100, so if you have a few extra large records in a batch then you may get a 413.

Assuming there are no reverse proxies in the middle with a lower body size limit, you can adjust Atuin’s limits with the following config on the server

max_history_length: <max length in bytes>
max_record_size: <max length in bytes>

max_history_length applies to sync v1, the other is for sync v2. If your clients have

[sync]
records = true

in the config, then you’re all setup with sync v2 :blush:

Setting either of those server config values to 0 totally disables any size limits

1 Like

The default config for the server spits out the following:

## Maximum size for one record entry
## 1024 * 1024 * 1024
# max_record_size = 1073741824

Does this mean that the default for the max of one record is 1GB? It’s probably hard to reach that limit with one command. :wink:

I’ve set these values to 0 but I’m still getting the 413.

What else can I do to debug this?

Nevermind. Moving to sync v2 on the client has overcome the issue.

(setting max_record_size and/or max_history_length to 0 seemed to make no difference)

Sync v1 used larger page sizes which were likely the problem. Glad it’s sorted!

This can often occur with proxies in the middle, if you’ve configured Atuin to have a larger record/history length