Help

Fix for INVALID_VALUE_FOR_COLUMN for single line text column

Topic Labels: API
11763 12
cancel
Showing results for 
Search instead for 
Did you mean: 
Case_Larsen
4 - Data Explorer
4 - Data Explorer

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.

12 Replies 12
EvanHahn
6 - Interface Innovator
6 - Interface Innovator

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.

openside
10 - Mercury
10 - Mercury

@Case_Larsen - is it possible you forgot to use the {typecast:true} feature in your recent calls?

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.

EvanHahn
6 - Interface Innovator
6 - Interface Innovator

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).

Gustavo_Costa
4 - Data Explorer
4 - Data Explorer

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.

gdc

Gustavo_Costa
4 - Data Explorer
4 - Data Explorer

I chaged the field type to ```
SingleLineText

Could you include a code snippet of your problem (without your API key!) and the exact error you’re receiving?

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.

Best

We’ve thought about improving API error messages and will keep this in mind as we work on future versions—we’ll add this to the list. Thanks!