mattermost-community/focalboard · error

could not get history for board: %w

Error message

could not get history for board: %w

What it means

getBoardHistory reads the board's history entries via store.GetBoardHistory with a limit of 1 (first or latest revision). This error wraps any failure of that store call under a contextual message. Callers are GetBoardMetadata and getBoardDescendantModifiedInfo, so this surfaces when computing board metadata or last-modified info.

Source

Thrown at server/app/boards.go:98

		return nil, fmt.Errorf("cannot get block %s: %w", blockID, err)
	}

	board, err := a.GetBoard(block.BoardID)
	if err != nil {
		return nil, fmt.Errorf("cannot get board %s: %w", block.BoardID, err)
	}

	return board, nil
}

func (a *App) getBoardHistory(boardID string, latest bool) (*model.Board, error) {
	opts := model.QueryBoardHistoryOptions{
		Limit:      1,
		Descending: latest,
	}
	boards, err := a.store.GetBoardHistory(boardID, opts)
	if err != nil {
		return nil, fmt.Errorf("could not get history for board: %w", err)
	}
	if len(boards) == 0 {
		return nil, nil
	}

	return boards[0], nil
}

func (a *App) getBoardDescendantModifiedInfo(boardID string, latest bool) (int64, string, error) {
	board, err := a.getBoardHistory(boardID, latest)
	if err != nil {
		return 0, "", err
	}
	if board == nil {
		return 0, "", fmt.Errorf("history not found for board: %w", err)
	}

	var timestamp int64

View on GitHub (pinned to a84bbb65e3)

Solutions

  1. Check the wrapped cause for store/database errors and confirm the board history table/collection exists.
  2. Verify the boardID is valid before calling metadata APIs.
  3. Retry on transient database errors.
  4. If using a plugin/custom store implementation, confirm GetBoardHistory is implemented.
Defensive patterns

Strategy: retry

Validate before calling

if boardID == "" {
    return errors.New("cannot read board history: empty boardID")
}
if _, err := app.GetBoard(boardID); err != nil {
    return fmt.Errorf("board %s invalid before history query: %w", boardID, err)
}

Try / catch

meta, err := app.GetBoardMetadata(boardID, latest)
if err != nil {
    if strings.Contains(err.Error(), "could not get history for board") && isTransient(err) {
        time.Sleep(backoff)
        meta, err = app.GetBoardMetadata(boardID, latest) // retry once
    }
    if err != nil {
        return err
    }
}

Prevention

When it happens

Trigger: Calling GetBoardMetadata (or code paths reaching getBoardHistory) where store.GetBoardHistory errors: malformed boardID, database query failure, or a backing store that does not support board history.

Common situations: Databases migrated without the history tables/collections populated or created; permission-filtered store returning an error; transient DB outages while loading board metadata.

Related errors


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