{"record":{"id":"40e8a7047949ef48","repo":"Mintplex-Labs/anything-llm","slug":"community-hub-connection-key-not-found","errorCode":null,"errorMessage":"Community Hub connection key not found","messagePattern":"Community Hub connection key not found","errorType":"validation","errorClass":"Error","httpStatus":500,"severity":"error","filePath":"server/endpoints/communityHub.js","lineNumber":193,"sourceCode":"        const { connectionKey } = await SystemSettings.hubSettings();\n        const items = await CommunityHub.fetchUserItems(connectionKey);\n        response.status(200).json({ success: true, ...items });\n      } catch (error) {\n        console.error(error);\n        response.status(500).json({ success: false, error: error.message });\n      }\n    }\n  );\n\n  app.post(\n    \"/community-hub/:communityHubItemType/create\",\n    [validatedRequest, flexUserRoleValid([ROLES.admin])],\n    async (request, response) => {\n      try {\n        const { communityHubItemType } = request.params;\n        const { connectionKey } = await SystemSettings.hubSettings();\n        if (!connectionKey)\n          throw new Error(\"Community Hub connection key not found\");\n\n        const data = reqBody(request);\n        const { success, error, itemId } = await CommunityHub.createStaticItem(\n          communityHubItemType,\n          data,\n          connectionKey\n        );\n        if (!success) throw new Error(error);\n\n        await EventLogs.logEvent(\n          \"community_hub_publish\",\n          { itemType: communityHubItemType },\n          response.locals?.user?.id\n        );\n        response\n          .status(200)\n          .json({ success: true, error: null, item: { id: itemId } });\n      } catch (error) {","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/endpoints/communityHub.js#L175-L211","documentation":"Thrown by POST /community-hub/:communityHubItemType/create when SystemSettings.hubSettings() returns no connectionKey. The connectionKey is the credential used to authenticate publish/create calls against the remote Community Hub service, so without it the downstream CommunityHub.createStaticItem call cannot proceed. This is a configuration precondition, not a runtime fault.","triggerScenarios":"An admin user clicks 'Publish to Community Hub' before configuring the connection key in System Settings. Also if the setting was saved as an empty string or cleared.","commonSituations":"Fresh installation where Community Hub was never set up; an admin rotated/cleared the key; the hubSettings() loader failed silently and defaulted to empty.","solutions":["Navigate to System Settings → Community Hub and enter the connection key issued by the hub.","Verify the key saved by re-opening the settings panel (not just submitting).","Check that hubSettings() reads from the correct settings row and is not masked by an env override.","If the key was revoked, obtain a new one from the Community Hub administrator."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const { connectionKey } = await SystemSettings.hubSettings();\nif (!connectionKey) {\n  return res.status(400).json({ success: false, error: 'Configure the Community Hub connection key in System Settings first.' });\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Surface a UI warning on the publish button when no connection key is configured.","Validate the key is set before showing the publish action.","Centralize the hubSettings() check in middleware for all hub routes."],"tags":["community-hub","configuration","authentication","missing-credential"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}