An item with the same key has already been added error even though the whole column is empty

Im having an issue where no matter what, I get an error that “An item with the same key has already been added.” even though the whole key column is completely empty. I have tried using now(), UTCNOW(), and UNIQUEID() with the same result for all instances. HELP?

Does this mean the entire Table is empty? A blank value is still a key value, and Appsheet won’t allow you to add another record with the same key.

You tried using these where? What is your Key column?

2 Likes

My key column is column A with “Key” in cell A1 and nothing else in the rest of the column

I used those functions in the Initial Value box in the variable I have marked as my Key

Please post a screenshot of the error.

1 Like

It gives the same error in the mobile client also
@Steve

1 Like

Hi @Matthew_Reddy
Does your key column look like this?

1 Like

@Lynn Yes it does

1 Like

@Marc_Dillon

What happened before this error?

Have you configured any custom actions?

@Marc_Dillon All I did was fill out the form that is supposed to input to google sheets and hit save

@Steve I have not

1 Like

Are there any formulas in or that affect the column of the spreadsheet that the app is using as the key column?

I’d suggest take a look at the audit log history from the Manage → Monitoring pane of the app editor. It will show you what exactly is being added and that may be helpful

1 Like

@Steve No, the column is completely blank except for the heading

@praveen


Here is the log. The error always occurs on “Add Row” and the details are as follows:
Action Details
Email Details
Error:
“System.ArgumentException: An item with the same key has already been added.\r\n at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)\r\n at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add)\r\n at OfficeOpenXml.Table.ExcelTableCollection..ctor(ExcelWorksheet ws)\r\n at OfficeOpenXml.ExcelWorksheet.get_Tables()\r\n at OfficeOpenXml.ExcelWorksheet.SaveTables()\r\n at OfficeOpenXml.ExcelWorksheet.Save()\r\n at OfficeOpenXml.ExcelWorkbook.Save()\r\n at OfficeOpenXml.ExcelPackage.Save()\r\n at OfficeOpenXml.ExcelPackage.SaveAs(Stream OutputStream)\r\n at Nirvana.Data.XlsxSpreadsheetData.AppendRows(Context context, Op op, Int32 ownerId, String userToken, String tableQualifier, List1 colTypes, List1 keyPositions)\r\n at Nirvana.Data.GDriveStorageProvider.AppendTableRows(Context context, Op op, String name, Int32 ownerId, String userToken, PhysicalSchema physicalSchema, DataFormat fileFormat, List1 colTypes, List1 keyPositions)\r\n at Nirvana.Data.DataLayer.AppendTableRows(Context context, Op op, Int32 ownerId, AppTable appTable, List1 colTypes, List1 keyPositions)\r\n at Nirvana.Internal.InternalAPI.AddTableRowInternal(Context context, Op op, Int32 userId, Int32 executeAs, ChangeEventWorkflowRuleEvaluator changeEventWorkflowRuleEvaluator)\r\n at Nirvana.Internal.InternalAPI.PerformOperation(IPerfCollector perfCollector, Context context, Op op, Int32 userId, String appTemplateVersion, Boolean& success, String& errorMessage, Exception& errorException, UpdateModeEnum requiredUpdateMode, RowOperation rowOperation)" Properties: { "TableName": "Restock Sheet", "apiLevel": "2", "appStartTime": "2021-05-21T12:52:10.657Z", "appTemplateVersion": "1.000017", "build": "c1568b8d4af93c30a536-1621550456145-3cd00f3e", "checkCache": "true", "clientId": "28a00899-59fa-4fea-a458-c50bd7a57144", "dataStamp": "2021-05-21T12:52:47.782Z", "isPreview": "false", "lastSyncTime": "2021-05-21T12:52:10.0867982Z", "localVersion": "1.000017", "locale": "en", "mechanism": "Form", "requestId": "98989393", "requestStartTime": "2021-05-21T12:52:48.007Z", "timestamp": "2021-05-21T12:52:47.778Z", "tzOffset": "360", "viewName": "Post-Job Restock", "AppTemplateVersion": "1.000017", "RowSize": 37, "AppTemplateName": "89f7efe6-30d8-4fec-a8b7-7124b04c945d", "Operation": "Add row", "RecordType": "Stop", "Errors": "Unable to add/edit/delete row in table 'Restock Sheet'. → An item with the same key has already been added.", "Exception": "System.ArgumentException: An item with the same key has already been added.\r\n at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)\r\n at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add)\r\n at OfficeOpenXml.Table.ExcelTableCollection…ctor(ExcelWorksheet ws)\r\n at OfficeOpenXml.ExcelWorksheet.get_Tables()\r\n at OfficeOpenXml.ExcelWorksheet.SaveTables()\r\n at OfficeOpenXml.ExcelWorksheet.Save()\r\n at OfficeOpenXml.ExcelWorkbook.Save()\r\n at OfficeOpenXml.ExcelPackage.Save()\r\n at OfficeOpenXml.ExcelPackage.SaveAs(Stream OutputStream)\r\n at Nirvana.Data.XlsxSpreadsheetData.AppendRows(Context context, Op op, Int32 ownerId, String userToken, String tableQualifier, List1 colTypes, List1 keyPositions)\r\n at Nirvana.Data.GDriveStorageProvider.AppendTableRows(Context context, Op op, String name, Int32 ownerId, String userToken, PhysicalSchema physicalSchema, DataFormat fileFormat, List1 colTypes, List1 keyPositions)\r\n at Nirvana.Data.DataLayer.AppendTableRows(Context context, Op op, Int32 ownerId, AppTable appTable, List1 colTypes, List1 keyPositions)\r\n at Nirvana.Internal.InternalAPI.AddTableRowInternal(Context context, Op op, Int32 userId, Int32 executeAs, ChangeEventWorkflowRuleEvaluator changeEventWorkflowRuleEvaluator)\r\n at Nirvana.Internal.InternalAPI.PerformOperation(IPerfCollector perfCollector, Context context, Op op, Int32 userId, String appTemplateVersion, Boolean& success, String& errorMessage, Exception& errorException, UpdateModeEnum requiredUpdateMode, RowOperation rowOperation)”,
“ReturnedFromCache”: false,
“Performance”: “{“Version”:1,“Time”:“00:00:02.1075861”,“PerformanceTimingRoot”:{“Mid”:100,“Timer”:{“Time”:“00:00:02.1075861”},“Children”:[{“Mid”:108,“Timer”:{“Time”:“00:00:02.1075831”},“Children”:[{“Mid”:466,“Timer”:{“Time”:“00:00:00.2009424”}},{“Mid”:101,“Timer”:{“Time”:“00:00:01.9064000”},“Children”:[{“Mid”:21,“Timer”:{“Time”:“00:00:01.9054426”},“Children”:[{“Mid”:25,“Timer”:{“Time”:“00:00:00.0512279”}},{“Mid”:53,“Timer”:{“Time”:“00:00:01.8027983”},“Children”:[{“Mid”:458,“Timer”:{“Time”:“00:00:00.1801809”}},{“Mid”:98,“Params”:{“ParamList”:[{“Pid”:13,“Value”:“SeismosInventory-3240394”},{“Pid”:17,“Value”:“DocId=1uXRP60IHYOxoRGcl0VESMHv4tqoeVE6L”}]},“Timer”:{“Time”:“00:00:01.2395428”},“Children”:[{“Mid”:99,“Params”:{“ParamList”:[{“Pid”:4,“Value”:“364,273”}]},“Timer”:{“Time”:“00:00:01.2395287”},“Children”:[{“Mid”:385,“Timer”:{“Time”:“00:00:01.0050911”},“Children”:[{“Mid”:386,“Timer”:{“Time”:“00:00:01.0050651”}}]},{“Mid”:193,“Params”:{“ParamList”:[{“Pid”:13,“Value”:“Unknown”}]},“Timer”:{“Time”:“00:00:00.2344006”},“Children”:[{“Mid”:191,“Timer”:{“Time”:“00:00:00.0222257”}},{“Mid”:194,“Timer”:{“Time”:“00:00:00.2121579”}}]}]}]},{“Mid”:49,“Timer”:{“Time”:“00:00:00.0258818”},“Children”:[{“Mid”:48,“Timer”:{“Time”:“00:00:00.0254741”},“Children”:[{“Mid”:138,“Params”:{“ParamList”:[{“Pid”:8,“Value”:“210”},{“Pid”:2,“Value”:“34”}]},“Timer”:{“Time”:“00:00:00.0077336”}},{“Mid”:46,“Timer”:{“Time”:“00:00:00.0168384”},“Children”:[{“Mid”:47,“Timer”:{“Time”:“00:00:00.0166410”}}]}]}]}]}]}]}]}]},“IsEmpty”:false}”,
“Result”: “Failure”
}

1 Like

1 Like

That looks like an internal bug. Please contact support@appsheet.com for further help with this.