This behavior started a couple weeks ago. Using Airtable’s airtable JS API v0.5.8, I used to be able to call update() successfully on table where the value for column to be updated was a javascript number.
Now it returns the error INVALID_VALUE_FOR_COLUMN. When I convert the number to a string before passing it into the update() call, it works.
Just a workaround FYI for others. It seems like is some stronger API checking going on on the Airtable server API side.
Interesting—I wonder if this is a newly-introduced bug. Are you failing to update a number field with a number, or a number field with a string, or a text field with a number? (Or something else?)
Sample code and a description of the base would help us reproduce this so we can get this solved.
Here’s a repro case for a table with column “SingleLineText” which is of type single line text:
var Airtable = require('airtable')
var base = new Airtable({ apiKey: '<your key>' }).base('<your table id>')
base('Table 1').create({
'SingleLineText': 123
}, function (err, record) {
if (err) { console.error(err); return }
console.log('created', record.getId())
})
base('Table 1').create({
'SingleLineText': '456'
}, function (err, record) {
if (err) { console.error(err); return }
console.log('created', record.getId())
})
results in
created recc5jiGDbSGlpEsR
Class {
error: 'INVALID_VALUE_FOR_COLUMN',
message: 'Field SingleLineText cannot accept the provided value',
statusCode: 422 }
and resulting table having only one row with “456” in the SingleLineText column. i.e. the operation with 123 failed.
@openside I didn’t see typecast in the documentation, and it had been working for a few weeks already as-is, but good to know.
As said, i think it’s probably increased API strictness (not a bug) which is ok, and the original request submitted an integer, not a string value, so I’d still need to cast values to a string before adding the typecast directive.
We’ll look into whether this is a bigger issue, so thanks for bringing this to our attention.
It sounds like your issue has been solved, which is great! Let us know if you run into any other issues (or if I misunderstood and your issue isn’t solved).
Hi EvanHahn,
I have the same error today. The field type is Barcode (Named GTIN) and I have tried to insert the GTIN code (13 digits) as text and as number. The error is the same.
Hi EvanHahn,
I found out why I had the problem with barcode field.
I didn’t realize before that, the “barcode” type field is an array with two elements, one “type” and another “text”.
So the correct in my case (PHP) is: $data = array(“fields” => array(“Product” => $p_Product, **
** “GTIN” => array(“type” => “”, “text” => “”.$p_GTIN), **
** “Value” => (0 + $p_Palue) **
** ));
This solve the problem.
I sugest that the error return array be more explanatory about the error and show the values received. This will help debug the problem. I saw that a lot of people asks about these API insert/replace errors.
I wish this said: Field SingleLineText cannot accept the provide value… because e.g. its type ‘Object’ is incompatible with the ‘String’ type of the field. (or something like that).