Affected versions
- Nextcloud: 33.0.2+ (QueryBuilder API split)
- maps app: 1.6.0
Symptom
Creating or updating a contact with an ADR (address) property via CardDAV fails with HTTP 500:
RuntimeException: Invalid query type, expected INSERT, DELETE or UPDATE statement
The error occurs in AddressService.php line 252 inside cleanUpDBContactAddresses().
Root cause
In Nextcloud 33, the QueryBuilder API was split into two methods:
- executeQuery() — for SELECT queries only (returns IResult)
- executeStatement() — for INSERT/UPDATE/DELETE only
The maps app incorrectly calls $qb->executeStatement() on a SELECT query at line 252 of AddressService.php:
// AddressService.php lines 249-252 (broken)
$qb->select('id', 'adr')
->from('maps_address_geo')
->where($qb->expr()->eq('object_uri', $qb->createNamedParameter($uri, IQueryBuilder::PARAM_STR)));
$req = $qb->executeStatement(); // WRONG: SELECT needs executeQuery()
Stack trace (from Nextcloud log)
RuntimeException: Invalid query type, expected INSERT, DELETE or UPDATE statement
at /var/www/html/nextcloud/apps/maps/lib/Service/AddressService.php:252
AddressService->cleanUpDBContactAddresses()
at /var/www/html/nextcloud/apps/maps/lib/Service/AddressService.php:225
AddressService->scheduleVCardForLookup()
at /var/www/html/nextcloud/apps/maps/lib/Listener/CardCreatedListener.php:50
CardCreatedListener->handle()
Impact
- Any client creating/updating contacts with address fields fails to sync (HTTP 500)
- Error triggers on every CardDAV PUT that contains an ADR property
- Other DAV operations (calendar, files) are unaffected
- No data corruption — error is caught and returned as HTTP 500
Fix
Change line 252 of apps/maps/lib/Service/AddressService.php:
- $req = $qb->executeStatement();
- $req = $qb->executeQuery();
No other changes needed — all other QueryBuilder calls in this file are correct (DELETE and INSERT statements
properly use executeStatement()).
Affected versions
Symptom
Creating or updating a contact with an ADR (address) property via CardDAV fails with HTTP 500:
RuntimeException: Invalid query type, expected INSERT, DELETE or UPDATE statement
The error occurs in AddressService.php line 252 inside cleanUpDBContactAddresses().
Root cause
In Nextcloud 33, the QueryBuilder API was split into two methods:
The maps app incorrectly calls $qb->executeStatement() on a SELECT query at line 252 of AddressService.php:
// AddressService.php lines 249-252 (broken)
$qb->select('id', 'adr')
->from('maps_address_geo')
->where($qb->expr()->eq('object_uri', $qb->createNamedParameter($uri, IQueryBuilder::PARAM_STR)));
$req = $qb->executeStatement(); // WRONG: SELECT needs executeQuery()
Stack trace (from Nextcloud log)
RuntimeException: Invalid query type, expected INSERT, DELETE or UPDATE statement
at /var/www/html/nextcloud/apps/maps/lib/Service/AddressService.php:252
AddressService->cleanUpDBContactAddresses()
at /var/www/html/nextcloud/apps/maps/lib/Service/AddressService.php:225
AddressService->scheduleVCardForLookup()
at /var/www/html/nextcloud/apps/maps/lib/Listener/CardCreatedListener.php:50
CardCreatedListener->handle()
Impact
Fix
Change line 252 of apps/maps/lib/Service/AddressService.php:
No other changes needed — all other QueryBuilder calls in this file are correct (DELETE and INSERT statements
properly use executeStatement()).