{"record":{"id":"3b3129514bba9bf1","repo":"nextcloud/server","slug":"could-not-enable-bundle","errorCode":null,"errorMessage":"could not enable bundle","messagePattern":"could not enable bundle","errorType":"exception","errorClass":"OCSException","httpStatus":500,"severity":"error","filePath":"apps/appstore/lib/Controller/ApiController.php","lineNumber":293,"sourceCode":"\t *\n\t * @param string $bundleId - The bundle to enable\n\t * @return DataResponse<Http::STATUS_OK, array{}, array{}>\n\t * @throws OCSException - if the bundle, or one app within, could not be enabled\n\t *\n\t * 200: Bundle successfully enabled\n\t */\n\t#[PasswordConfirmationRequired(strict: true)]\n\t#[ApiRoute(verb: 'POST', url: '/api/v1/bundles/enable')]\n\tpublic function enableBundle(string $bundleId): DataResponse {\n\t\ttry {\n\t\t\t$bundle = $this->bundleFetcher->getBundleByIdentifier($bundleId);\n\t\t\t$this->config->setSystemValue('maintenance', true);\n\t\t\t$this->installer->installAppBundle($bundle);\n\t\t} catch (\\BadMethodCallException $e) {\n\t\t\tthrow new OCSNotFoundException('Bundle not found', $e);\n\t\t} catch (\\Exception $exception) {\n\t\t\t$this->logger->error('could not enable bundle', ['bundleId' => $bundleId, 'exception' => $exception]);\n\t\t\tthrow new OCSException('could not enable bundle', Http::STATUS_INTERNAL_SERVER_ERROR, $exception);\n\t\t} finally {\n\t\t\t$this->config->setSystemValue('maintenance', false);\n\t\t}\n\n\t\treturn new DataResponse([]);\n\t}\n\n\t/**\n\t * Convert URL to proxied URL so CSP is no problem\n\t */\n\tprivate function createProxyPreviewUrl(string $url): string {\n\t\tif ($url === '') {\n\t\t\treturn '';\n\t\t}\n\n\t\treturn 'https://usercontent.apps.nextcloud.com/' . base64_encode($url);\n\t}\n","sourceCodeStart":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/nextcloud/server/blob/ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3/apps/appstore/lib/Controller/ApiController.php#L275-L311","documentation":"OCSException (HTTP 500) thrown by ApiController::enableBundle when getBundleByIdentifier succeeds but installing the bundle's apps (installAppBundle) throws a regular Exception (not BadMethodCallException). Maintenance mode is toggled around the install and reset in finally, and the failing exception is logged as 'could not enable bundle' with the bundleId.","triggerScenarios":"POST /ocs/appstore/bundles/enable where any app inside the bundle fails to download, extract, or enable — same root causes as single-app enable failures: no appstore egress, apps/ not writable, PHP/NC version constraints of one bundled app unmet.","commonSituations":"Offline/air-gapped servers; restrictive apps/ permissions; one app in the bundle incompatible with the server version; partial bundle install on retry because earlier apps already installed.","solutions":["Read nextcloud.log for 'could not enable bundle' — the chained exception identifies which bundled app failed","Enable the bundle's apps individually to isolate the failing one and address its specific requirement/permission issue","Verify app store reachability and apps/ writability, then retry the bundle","If maintenance mode remains on after a fatal, clear it with `occ maintenance:mode --off`"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n\tawait axios.post(generateOcsUrl('/apps/appstore/bundles/enable'), { bundleId })\n} catch (e) {\n\t// 500 'could not enable bundle' — the log entry 'could not enable bundle' names the failing app\n\t// fallback: enable the bundle's apps individually to isolate the culprit\n}","preventionTips":["Verify every app in the bundle is installable on this server (version, PHP, permissions) before enabling it as a group","Watch for maintenance mode leftovers after bundle failures"],"tags":["appstore","bundles","install","php","ocs"],"backgroundTag":"app-install-failed","analyzedSha":"ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3","analyzedAt":"2026-08-17T01:36:13.386Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}