{"record":{"id":"25c29675bdad0cc9","repo":"nextcloud/server","slug":"bundle-not-found","errorCode":null,"errorMessage":"Bundle not found","messagePattern":"Bundle not found","errorType":"http","errorClass":"OCSNotFoundException","httpStatus":404,"severity":"warning","filePath":"apps/appstore/lib/Controller/ApiController.php","lineNumber":290,"sourceCode":"\n\t/**\n\t * Enable all apps of a bundle\n\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","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/nextcloud/server/blob/ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3/apps/appstore/lib/Controller/ApiController.php#L272-L308","documentation":"OCSNotFoundException (HTTP 404) thrown by ApiController::enableBundle when bundleFetcher->getBundleByIdentifier($bundleId) raises BadMethodCallException, i.e. no app bundle with that identifier is known to the server. Bundles are server-side defined groups of apps (shipped with the appstore data), so the id space depends on the Nextcloud version.","triggerScenarios":"POST /ocs/appstore/bundles/enable with a bundleId that does not exist: id from a cached frontend bundle list of an older Nextcloud version, hand-typed/typo'd id, or an appstore backend that does not provide bundles.","commonSituations":"Browser tab left open across a server upgrade — the cached bundle list no longer matches; scripts automating bundle enable with hardcoded ids; third-party/custom appstore deployments without bundle metadata.","solutions":["Refetch the current bundle list from the apps/bundles listing endpoint and use ids from that response","Handle the 404 by refreshing the App Store view instead of retrying the same id","After a server upgrade, reload the settings page so stale bundle ids are discarded","Verify the id casing/format matches exactly"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate bundleId against the server's current bundle list\nconst bundles = (await axios.get(generateOcsUrl('/apps/appstore/bundles/list'))).data\nif (!bundles.some((b) => b.id === bundleId)) {\n\tthrow new Error(`Unknown bundle: ${bundleId}`)\n}\nawait axios.post(generateOcsUrl('/apps/appstore/bundles/enable'), { bundleId })","typeGuard":null,"tryCatchPattern":"try {\n\tawait axios.post(generateOcsUrl('/apps/appstore/bundles/enable'), { bundleId })\n} catch (e) {\n\tif (e?.response?.status === 404) {\n\t\t// 'Bundle not found' — refetch the bundle list and re-render\n\t} else throw e\n}","preventionTips":["Always take bundle ids from a fresh listing; never hardcode or cache across upgrades","Handle 404 by refreshing the view instead of retrying the stale id"],"tags":["appstore","bundles","not-found","php","ocs"],"backgroundTag":"resource-not-found-by-id","analyzedSha":"ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3","analyzedAt":"2026-08-17T01:36:13.386Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}