All Products
Search
Document Center

Tablestore:What do I do if the error "The count of attribute columns exceeds the maximum:128: is reported when I use Tablestore SDK for Java to write data to a Tablestore data table?

Last Updated:Feb 28, 2026

TableStoreWriter limits each row to 128 attribute columns by default. If your data table exceeds this limit, writes fail with this error.

To fix it, set MaxColumnsCount to a higher value when initializing WriterConfig. The maximum allowed value is 1024.

String instanceName = "yourInstanceName";
String endPoint = "yourEndpoint";
// Get the AccessKey ID and AccessKey secret from environment variables.
String accessKeyId = System.getenv("TABLESTORE_ACCESS_KEY_ID");
String accessKeySecret = System.getenv("TABLESTORE_ACCESS_KEY_SECRET");

ClientConfiguration cc = new ClientConfiguration();
cc.setRetryStrategy(new DefaultRetryStrategy());
AsyncClient asyncClient = new AsyncClient(endPoint, accessKeyId, accessKeySecret, instanceName, cc);

WriterConfig config = new WriterConfig();
config.setMaxColumnsCount(1024);  // Increase from the default 128 to 1024
config.setMaxBatchSize(4 * 1024 * 1024);       // Max batch request size. Default: 4 MB.
config.setBufferSize(1024);                     // Max rows buffered in memory. Default: 1024. Must be a power of 2.
config.setMaxBatchRowsCount(100);               // Max rows per batch. Default: 100.
config.setConcurrency(10);                      // Max parallel write requests. Default: 10.
config.setMaxAttrColumnSize(2 * 1024 * 1024);   // Max attribute column value size. Default: 2 MB.
config.setMaxPKColumnSize(1024);                // Max primary key column value size. Default: 1 KB.
config.setFlushInterval(10000);                 // Flush interval. Default: 10000 ms (10 seconds).

AtomicLong succeedCount = new AtomicLong();
AtomicLong failedCount = new AtomicLong();
TableStoreCallback<RowChange, ConsumedCapacity> callback = new SampleCallback(succeedCount, failedCount);
ExecutorService executor = Executors.newFixedThreadPool(2);
TableStoreWriter tablestoreWriter = new DefaultTableStoreWriter(asyncClient, tableName, config, callback, executor);
Note: Before running this code, configure your AccessKey pair through environment variables. For details, see Configure access credentials.

For the full TableStoreWriter reference, see Use TableStoreWriter to concurrently write data.