{"record":{"id":"59293d5047922b4b","repo":"mattermost-community/focalboard","slug":"turning-on-sharing-for-board-failed-see-log-for-d","errorCode":null,"errorMessage":"turning on sharing for board failed, see log for details","messagePattern":"turning on sharing for board failed, see log for details","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/api/sharing.go","lineNumber":16,"sourceCode":"package api\n\nimport (\n\t\"encoding/json\"\n\t\"errors\"\n\t\"io\"\n\t\"net/http\"\n\n\t\"github.com/gorilla/mux\"\n\t\"github.com/mattermost/focalboard/server/model\"\n\t\"github.com/mattermost/focalboard/server/services/audit\"\n\n\t\"github.com/mattermost/mattermost/server/public/shared/mlog\"\n)\n\nvar ErrTurningOnSharing = errors.New(\"turning on sharing for board failed, see log for details\")\n\nfunc (a *API) registerSharingRoutes(r *mux.Router) {\n\t// Sharing APIs\n\tr.HandleFunc(\"/boards/{boardID}/sharing\", a.sessionRequired(a.handlePostSharing)).Methods(\"POST\")\n\tr.HandleFunc(\"/boards/{boardID}/sharing\", a.sessionRequired(a.handleGetSharing)).Methods(\"GET\")\n}\n\nfunc (a *API) handleGetSharing(w http.ResponseWriter, r *http.Request) {\n\t// swagger:operation GET /boards/{boardID}/sharing getSharing\n\t//\n\t// Returns sharing information for a board\n\t//\n\t// ---\n\t// produces:\n\t// - application/json\n\t// parameters:\n\t// - name: boardID\n\t//   in: path","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/mattermost-community/focalboard/blob/a84bbb65e32edf972856b329417096ac413518e9/server/api/sharing.go#L1-L34","documentation":"ErrTurningOnSharing is the sentinel returned by handlePostSharing when enabling sharing on a board fails internally. The detailed reason is only written to the server log; the client gets this generic message.","triggerScenarios":"POST /boards/{boardID}/sharing where the handler's internal enable-sharing logic fails — typically invalid sharing payload, board not found, permission/store errors — after logging the details.","commonSituations":"Sharing a board that doesn't exist or was deleted; malformed sharing JSON body; permission denied for the requesting session; store/database failure during save.","solutions":["Inspect the server log at the time of the request for the wrapped root cause","Verify the boardID exists and the session user has permission to share it","Validate the request body matches the expected sharing JSON schema"],"exampleFix":"// before\nfetch('/api/v0/boards/' + badID + '/sharing', {method:'POST', body: body})\n// after\nconst res = await fetch('/api/v0/boards/' + boardID + '/sharing', {method:'POST', body: body})\nif (res.status === 500) {\n    alert('Sharing failed — check the board exists and you have permission (see server logs)')\n}","handlingStrategy":"try-catch","validationCode":"const res = await fetch(`/api/v0/boards/${boardID}/sharing`, {method:'HEAD'})\n// ensure boardID exists and session is valid before POSTing sharing","typeGuard":"func isSharingErr(err error) bool { return errors.Is(err, ErrTurningOnSharing) }","tryCatchPattern":"if err := enableSharing(boardID, sharing); err != nil {\n    if errors.Is(err, ErrTurningOnSharing) {\n        logger.Error(\"enable sharing failed\", \"boardID\", boardID, \"err\", err)\n        a.errorResponse(w, r, ErrTurningOnSharing)\n        return\n    }\n}","preventionTips":["Check the server log immediately after a 500 from POST /boards/{id}/sharing — the root cause is only logged","Validate the sharing JSON payload against the expected schema client-side","Confirm boardID and permissions before calling the sharing endpoint","Retry only after confirming the board exists and the store is healthy"],"tags":["sharing","http","boards","api"],"backgroundTag":"sharing-enable-failed","analyzedSha":"a84bbb65e32edf972856b329417096ac413518e9","analyzedAt":"2026-08-30T09:22:20.720Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}