mattermost-community/focalboard · error

turning on sharing for board failed, see log for details

Error message

turning on sharing for board failed, see log for details

What it means

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.

Source

Thrown at server/api/sharing.go:16

package api

import (
	"encoding/json"
	"errors"
	"io"
	"net/http"

	"github.com/gorilla/mux"
	"github.com/mattermost/focalboard/server/model"
	"github.com/mattermost/focalboard/server/services/audit"

	"github.com/mattermost/mattermost/server/public/shared/mlog"
)

var ErrTurningOnSharing = errors.New("turning on sharing for board failed, see log for details")

func (a *API) registerSharingRoutes(r *mux.Router) {
	// Sharing APIs
	r.HandleFunc("/boards/{boardID}/sharing", a.sessionRequired(a.handlePostSharing)).Methods("POST")
	r.HandleFunc("/boards/{boardID}/sharing", a.sessionRequired(a.handleGetSharing)).Methods("GET")
}

func (a *API) handleGetSharing(w http.ResponseWriter, r *http.Request) {
	// swagger:operation GET /boards/{boardID}/sharing getSharing
	//
	// Returns sharing information for a board
	//
	// ---
	// produces:
	// - application/json
	// parameters:
	// - name: boardID
	//   in: path

View on GitHub (pinned to a84bbb65e3)

Solutions

  1. Inspect the server log at the time of the request for the wrapped root cause
  2. Verify the boardID exists and the session user has permission to share it
  3. Validate the request body matches the expected sharing JSON schema

Example fix

// before
fetch('/api/v0/boards/' + badID + '/sharing', {method:'POST', body: body})
// after
const res = await fetch('/api/v0/boards/' + boardID + '/sharing', {method:'POST', body: body})
if (res.status === 500) {
    alert('Sharing failed — check the board exists and you have permission (see server logs)')
}
Defensive patterns

Strategy: try-catch

Validate before calling

const res = await fetch(`/api/v0/boards/${boardID}/sharing`, {method:'HEAD'})
// ensure boardID exists and session is valid before POSTing sharing

Type guard

func isSharingErr(err error) bool { return errors.Is(err, ErrTurningOnSharing) }

Try / catch

if err := enableSharing(boardID, sharing); err != nil {
    if errors.Is(err, ErrTurningOnSharing) {
        logger.Error("enable sharing failed", "boardID", boardID, "err", err)
        a.errorResponse(w, r, ErrTurningOnSharing)
        return
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of mattermost-community/focalboard@a84bbb65e3 (2026-08-30). Data as JSON: /api/errors/59293d5047922b4b. Report an issue: GitHub.