nextcloud/server · error · OCSException
could not update app
Error message
could not update app
What it means
OCSException (HTTP 500) thrown by ApiController::updateApp when installer->updateAppstoreApp() returns false or throws. The controller sets maintenance mode to true before the update and back to false afterwards (including in catch), so the store app is replaced atomically; the wrapped \Exception is chained into the OCS error.
Source
Thrown at apps/appstore/lib/Controller/ApiController.php:267
* @throws OCSException - if the app could not be updated
*
* 200: App successfully updated
*/
#[PasswordConfirmationRequired(strict: true)]
#[ApiRoute(verb: 'POST', url: '/api/v1/apps/update')]
public function updateApp(string $appId): DataResponse {
$appId = $this->appManager->cleanAppId($appId);
$this->config->setSystemValue('maintenance', true);
try {
$result = $this->installer->updateAppstoreApp($appId);
$this->config->setSystemValue('maintenance', false);
if ($result === false) {
throw new \Exception('Update failed');
}
} catch (\Exception $exception) {
$this->config->setSystemValue('maintenance', false);
throw new OCSException('could not update app', Http::STATUS_INTERNAL_SERVER_ERROR, $exception);
}
return new DataResponse([]);
}
/**
* Enable all apps of a bundle
*
* @param string $bundleId - The bundle to enable
* @return DataResponse<Http::STATUS_OK, array{}, array{}>
* @throws OCSException - if the bundle, or one app within, could not be enabled
*
* 200: Bundle successfully enabled
*/
#[PasswordConfirmationRequired(strict: true)]
#[ApiRoute(verb: 'POST', url: '/api/v1/bundles/enable')]
public function enableBundle(string $bundleId): DataResponse {
try {View on GitHub (pinned to ecdeb153ff)
Solutions
- Confirm an update exists for the app at your Nextcloud version in the Apps page before calling update
- Check nextcloud.log for the chained exception and apps/ writability
- If the server is stuck in maintenance mode afterwards, run `occ maintenance:mode --off`
- Retry via `occ app:update <appId>` to see CLI-level errors
Defensive patterns
Strategy: try-catch
Try / catch
try {
await axios.post(generateOcsUrl('/apps/appstore/apps/update'), { appId })
} catch (e) {
// 500 'could not update app' — chained exception in nextcloud.log
// afterwards confirm maintenance mode was cleared: occ maintenance:mode --off
} Prevention
- Only offer Update when the app listing actually reports a newer version for your NC release
- Keep apps/ writable and appstore reachable before starting updates
- After any failed update, verify the maintenance flag is off before users report lockouts
When it happens
Trigger: POST /ocs/appstore/apps/update failing because no update is actually available for the current server version, the download from the app store failed, extraction/permission errors under apps/, or a mid-update database exception.
Common situations: Server without outbound access to the app store; apps/ not writable; app store not yet serving a compatible release for the installed Nextcloud version; concurrent update attempts; instance left in maintenance mode after a fatal (not caught) failure.
Related errors
- could not enable app
- could not disable app
- could not remove app
- Bundle not found
- could not enable bundle
AI-assisted analysis of nextcloud/server@ecdeb153ff (2026-08-17).
Data as JSON: /api/errors/8037fe84fb73ffa7.
Report an issue: GitHub.