Why might I be getting "missing record label identity" from the Ledger API when submitting a command?

Hi there!

I’m submitting a command to exercise a choice via the Ledger API, and one of the choice arguments is a custom data class, as below:

ProcessEvent: ContractId Product
   with productInfo: ProductInformation; eventAmount: Int
        eventId: Text; eventTimestamp: Int

In my java backend, I’m building the Value for the ProductInformation class like this:

List<Record.Field> fields = new ArrayList<>();
fields.add(myMapper.createField("textLabel", myMapper.textToValue(myText)));
fields.add(myMapper.createField("intLabel", myMapper.longToValue(myLong)));
Identifier identifier = new Identifier(packageId, "MyProject.Data", "ProductInformation");
return new Record(identifier, fields);

and then building the choice arguments in a similar way:

List<Record.Field> fields = new ArrayList<>();
fields.add(myMapper.createField("productInfo", generateProductInfo()));
fields.add(myMapper.createField("eventId", myMapper.textToValue(eventId)));
return new Record(fields);

But when I submit the final Record as the choice argument, I get this error:
INVALID_ARGUMENT: Command interpretation error in LF-DAMLe: Missing record label identity for record 68b265047338e0b799be857cc59d6e61de0c3e02ad9e229637023c923a927b4d:MyProject.Data:ProductInformation.

Can someone see what I’m doing wrong here? Thanks in advance!

  1. What is the template for ProductInformation?
  2. Any chance you may have added a field to it and somehow used a stale Daml package when running this?

ProductInformation looks roughly like this:

data ProductInformation = ProductInformation with
 productOwner: Party
 productId: Text
 countryCode: Text
  deriving(Eq, Show)

The packageId shown in the error above matches what’s running in the ledger, so I’m pretty sure it’s not an issue there, and nothing has changed with ProductInformation

It sounds like ProductInformation has a field named identity which you are not specifying. Can you show the full defininition?

Aaah! That’s it! I misnamed one of my data fields in the java! I thought it was simply a part of the error message as it’s not in quotes or anything, I guess it would have been more obvious if it had been another data field with a less ambiguous name!

Might be worth a small change to put quotes around that missing field name, in a future version!

Thanks for the help!


We’ll make sure to add quotes, thanks for the suggestion and glad you got it figured out!

1 Like

Maybe also change the error message to “missing record field” instead of “missing record label”? I think most users would be more familiar with the term “field” here.

Good idea, changed it.