8. 35 .

According to the problem, we have
$$
\left\{\begin{array}{l}
6 S_{n}=3 a_{n+1}+4^{n}-1, \\
6 S_{n-1}=3 a_{n}+4^{n-1}-1 .
\end{array}\right.
$$

Subtracting the two equations and simplifying, we get
$$
\begin{array}{l}
a_{n+1}=3 a_{n}-4^{n-1} \\
\Rightarrow a_{n+1}+4^{n}=3 a_{n}-4^{n-1}+4^{n} \\
\quad=3\left(a_{n}+4^{n-1}\right) \\
\Rightarrow a_{n}+4^{n-1}=3^{n-1}\left(a_{1}+1\right)=3^{n} \\
\Rightarrow a_{n}=3^{n}-4^{n-1} .
\end{array}
$$

Calculations show that
when $n \leqslant 4$, $a_{n}>0$;
when $n \geqslant 5$, $a_{n}<0$.
Thus, when $n=4$, $S_{n}$ reaches its maximum value of
$$
S_{4}=\sum_{i=1}^{4}\left(3^{i}-4^{i-1}\right)=35 .
$$
8. Given the sequence $\left\{a_{n}\right\}$ with the first term being 2, and satisfying
$$
6 S_{n}=3 a_{n+1}+4^{n}-1 \text {. }
$$

Then the maximum value of $S_{n}$ is $\qquad$