findBoardId(): Argument #1 ($id) must be of type int, string given when opening file attachment in card — popup freezes
Describe the bug When opening a file attachment inside a Deck card, the card popup expands to fullscreen and freezes. The UI becomes unresponsive and the card cannot be closed without a page reload.
Steps to reproduce
Open a Deck board Open a card that has a file attachment Click on the attachment to open it Card popup freezes and expands fullscreen
Expected behaviour The file opens normally without the popup freezing. Actual behaviour The popup freezes. The following error appears in the Nextcloud log:
TypeError: OCA\Deck\Db\CardMapper::findBoardId(): Argument #1 ($id) must be of type int, string given, called in /var/www/html/nextcloud/apps/deck/lib/Sharing/DeckShareProvider.php on line 984 app: no app in context
Nextcloud version: 33 Deck version: 1.17.0 (latest available for NC 33) Browser: [Firefox] OS: macOS
This is also manifesting in the files app. I guess there is a hook in place to find the card that a file might be attached to when files are moved. This same error is preventing me from moving files around.
Following the NC33 upgrade, I am seeing the same error on my side. Are there any known workarounds?
#7761 will fix the type error and make attachments movable again.
The popup view inside cards seems not to be related to this however according to my testing. The file view is still shown if the card is opened in the sidebar and not in the big view. So there's a second issue that makes the file view not render correctly.
This sounds related to my issue in #7713 as well
Same here in 33.0.2 with Deck 1.17.0
I have the same problem in 33.0.2 with Deck 1.17.0
This also happens when doing a full textsearch index:
An unhandled exception has been thrown:
TypeError: OCA\Deck\Db\CardMapper::findBoardId(): Argument #1 ($id) must be of type int, string given, called in /var/www/nextcloud/apps/deck/lib/Sharing/DeckShareProvider.php on line 1027 and defined in /var/www/nextcloud/apps/deck/lib/Db/CardMapper.php:632
Stack trace:
#0 /var/www/nextcloud/apps/deck/lib/Sharing/DeckShareProvider.php(1027): OCA\Deck\Db\CardMapper->findBoardId()
#1 /var/www/nextcloud/lib/private/Share20/Manager.php(1646): OCA\Deck\Sharing\DeckShareProvider->getAccessList()
#2 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/LocalFilesService.php(99): OC\Share20\Manager->getAccessList()
#3 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(723): OCA\Files_FullTextSearch\Service\LocalFilesService->getShareUsersFromFile()
#4 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(649): OCA\Files_FullTextSearch\Service\FilesService->updateShareNames()
#5 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(623): OCA\Files_FullTextSearch\Service\FilesService->updateDocumentAccess()
#6 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(605): OCA\Files_FullTextSearch\Service\FilesService->updateFilesDocumentFromFile()
#7 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(500): OCA\Files_FullTextSearch\Service\FilesService->updateFilesDocument()
#8 /var/www/nextcloud/apps/files_fulltextsearch/lib/Provider/FilesProvider.php(228): OCA\Files_FullTextSearch\Service\FilesService->generateDocument()
#9 /var/www/nextcloud/apps/fulltextsearch/lib/Service/IndexService.php(294): OCA\Files_FullTextSearch\Provider\FilesProvider->fillIndexDocument()
#10 /var/www/nextcloud/apps/fulltextsearch/lib/Service/IndexService.php(174): OCA\FullTextSearch\Service\IndexService->indexDocuments()
#11 /var/www/nextcloud/apps/fulltextsearch/lib/Command/Index.php(325): OCA\FullTextSearch\Service\IndexService->indexProviderContentFromUser()
#12 /var/www/nextcloud/apps/fulltextsearch/lib/Command/Index.php(202): OCA\FullTextSearch\Command\Index->indexProvider()
#13 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(326): OCA\FullTextSearch\Command\Index->execute()
#14 /var/www/nextcloud/core/Command/Base.php(220): Symfony\Component\Console\Command\Command->run()
#15 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1083): OC\Core\Command\Base->run()
#16 /var/www/nextcloud/3rdparty/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()
#17 /var/www/nextcloud/3rdparty/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
#18 /var/www/nextcloud/lib/private/Console/Application.php(187): Symfony\Component\Console\Application->run()
#19 /var/www/nextcloud/console.php(92): OC\Console\Application->run()
#20 /var/www/nextcloud/occ(33): require_once('...')
This also happens when Nextcloud Office Collabora tries to save a document, which is really annoying.
It's invoking this error over Activities and then returning 500 because of the error.
Argument #1 ($id) must be of type int, string given
Workaround was to set the incoming string as an int
$boardId = $this->cardMapper->findBoardId((int)$cardId);
Closing this as we already have a separate task for the modal broken issue - https://github.com/nextcloud/deck/issues/7916
Possible same root cause as #7419
I'm the reporter of #7419, which hits the same underlying defect via a different call site. Posting here so the two threads are cross-linked — might help with triage since this looks like one defect class, not two separate bugs.
In #7419 (NC 32.0.9.2, Deck 1.16.4), the crash happens via ShareAPIHelper::formatShare():
$boardId = $this->cardMapper->findBoardId($card->getId());
// $boardId can legitimately be null here (per its own ?int contract)
// when the card's stack_id points to a hard-deleted stack — but the
// result is passed straight into linkToRouteAbsolute() without a check.
I confirmed this against production data: a card whose stack_id pointed to a stack that no longer existed in oc_deck_stacks at all (not soft-deleted, just gone — likely a board deletion that didn't cascade properly). findBoardId() correctly returned null, but nothing downstream checked for that before generating the route, which threw Symfony's InvalidParameterException for an empty boardId.
Here, DeckShareProvider.php:984 calls the same CardMapper::findBoardId() but with strict int typing on the parameter, so a non-int-coercible value throws a TypeError instead — a different exception, but plausibly the same broken card → stack → board chain reaching the same function without a guard.
If that's correct, a fix would need two things in findBoardId()'s callers: (1) treat a null result as "skip this entry" rather than passing it through (relevant to #7419's call site), and (2) make sure the value handed to findBoardId() itself is always a valid int before the call (relevant to this issue's call site). I posted a more detailed writeup with a suggested minimal patch over in #7419 if it's useful context.