Maximum collection name length on Couchbase 7

This was experienced on my local setup : Couchbase Community 7.0.2 + python 3.8.10 + library 3.2.7

I made a bucket called “test” and a scope called “test_scope”

I am able to upsert documents into any collection with a name of 30 characters or less, however any more and it fails with InvalidArgumentException.

For example, I can call the collection “test_collection” but not “test_collection_with_a_long_name”

This only errors in the Python SDK, as through the admin portal I can create documents without any problem in the longer collections.

Has anyone else experienced this?

The full error is:
InvalidArgumentException: <RC=0xCB[LCB_ERR_INVALID_ARGUMENT (203)], There was a problem scheduling your request, or determining the appropriate server or vBucket for the key(s) requested. This may also be a bug in the SDK if there are no network issues, C Source=(src/store.c,288)>

https://docs.couchbase.com/cloud/clusters/data-service/scopes-collections.html#create-a-collection

  1. Specify a name for the collection.

In the Name of collection field, enter a name for the collection. A collection name can only contain the A-Z, a-z, and 0-9 characters as well as the -, _, and % symbols. It cannot start with either the _ or % symbols. It cannot be longer than 251 characters in length and is case-sensitive.

@vsr1 Yes I saw that, but in this case it’s causing errors after 30 characters, that’s my issue

Hi @michael_em, this was fixed in the underlying c library (https://issues.couchbase.com/browse/CCBC-1526) but a 3.x python SDK hasn’t been released since. To fix the issue you can upgrade to python SDK 4.0.3

2 Likes

@jrawsthorne Awesome thanks, I’ll try this right now :slight_smile:

UPDATE : Yes this fixed it. Quite a lot of N1QL changes from V3 to V4 but worth it in the end :slight_smile: