Forum

Author Topic: GPKG export fails with SQL logic error when saving attributes in Metashape 2.3.0  (Read 40879 times)

dancmar

  • Newbie
  • *
  • Posts: 10
    • View Profile
Hi!
I wanted to see if the GPKG format could be useful to me and a problem occurred during export.

Bug: GeoPackage export produces empty gpkg_contents and SQL logic error when save_attributes/save_elevation are enabled (Metashape 2.3.0 b21868).

n Metashape 2.3.0 (b21868), exporting Shapes to GeoPackage reproducibly fails with “SQL logic error (1)” when save_attributes and/or save_elevation are enabled. The resulting .gpkg file is created but contains only metadata tables and no entries in gpkg_contents.

I tried to present the circumstances in which I get this error through a script made with AI.

I found an older thread that identified the same error.
https://www.agisoft.com/forum/index.php?topic=16227.0

I am attaching the generated report.

""

« Last Edit: January 10, 2026, 03:04:53 PM by dancmar »

dancmar

  • Newbie
  • *
  • Posts: 10
    • View Profile
I am also attaching the script that queries AG.
I'm back with an attempt to narrow down the problem area.

dancmar

  • Newbie
  • *
  • Posts: 10
    • View Profile
From the log it is clear:
base_min ✅ (labels off, attrs off, student off)
labels_only ✅ (labels on, attrs off, elev off)
elev_only ✅ (labels off, attrs off, elev on)
labels_student ✅ (labels on, attrs off, student on)
But any combination that includes save_attributes = on fails with:
attrs_only ❌ SQL logic error (1)
labels_attrs ❌ SQL logic error (1)
attrs_elev ❌ SQL logic error (1)
full ❌ SQL logic error (1)

Metashape 2.3.0 b21868: GeoPackage export fails with “SQL logic error (1)” when save_attributes=True




dancmar

  • Newbie
  • *
  • Posts: 10
    • View Profile
I noticed that when save_attributes=True the export takes 13–20 sec and then fails (exit code 0 but with error), which suggests that the bug occurs when trying to create/write tables/fields in SQLite (attributes). This reinforces the cause.

dancmar

  • Newbie
  • *
  • Posts: 10
    • View Profile
I found the problem. I shouldn't have had an attribute named "Layer".
The same thing generates an error when saving a project in Agisoft Viewer, after importing shape entities with attributes with this name.
« Last Edit: January 12, 2026, 03:49:55 AM by dancmar »