5. Given the function
$$
y=a^{x+3}-2(a>0, a \neq 1)
$$

the graph always passes through a fixed point $A$. If point $A$ lies on the line
$$
\frac{x}{m}+\frac{y}{n}+1=0(m, n>0)
$$

then the minimum value of $3 m+n$ is
5. 16 .

Note that the function
$$
y=a^{x+3}-2(a>0, a \neq 1)
$$

always passes through the fixed point $(-3,-1)$.
So point $A(-3,-1)$.
Then $-\frac{3}{m}-\frac{1}{n}+1=0 \Rightarrow 1=\frac{3}{m}+\frac{1}{n}$.
Thus, $3 m+n=(3 m+n)\left(\frac{3}{m}+\frac{1}{n}\right)$
$$
=10+\frac{3 n}{m}+\frac{3 m}{n} \geqslant 16 \text {. }
$$

When and only when $m=n=4$, the equality holds. Therefore, the minimum value of $3 m+n$ is 16.