Your #n times n#, #color(red)(A) color(blue)( mathbf x) = color(green)(mathbf b)#, system in matrix form is:
#color(red)( ((1,2,3), (3,1,5), (4, 1, a^2  14)) ) color(blue)( ((x), (y),(z)) )= color(green)( ((4), (2),(a+2)) )#
When there is no obvious linear pattern  in terms of the row and column vectors dependence  the easiest thing to do is to start row reducing. I cannot get Gaussian elimination working on Socratic so will just stack the numbers up in brackets:
#((1,2,3), (3,1,5), (4, 1, a^2  14)) ((4), (2),(a+2))#
#R2 to R2  3R1, R3 to R3  4 R1 #
#((1,2,3), (0,7,14), (0, 7, a^2  2)) ((4), (10),(a14))#
#R3 to R3  R2#
#((1,2,3), (0,7,14), (0, 0, a^2  16)) ((4), (10),(a4))#
So we have this:
#((1,2,3), (0,7,14), (0, 0, a^2  16)) ((x), (y),(z))= ((4), (10),(a4))#
If we start at the bottom:
#(a^2  16)z = a4#
#implies (a4)(a + 4)z = a4#
So we go through the scenarios:

If #a = 4#, then the solution is everything in #\mathcal R^2#. There are an infinite number of solutions for z.

If #a ne 4#, that last equation becomes: #(a + 4)z = 1 implies z = 1/(a + 4)#. In that event, #x# and #y# are just linear combinations of #z#.

However, if #a = 4#, there is no solution to the matrix equation.
We can explore this a bit more.
If #a = 4#, we have this:
#((1,2,3), (0,7,14), (0, 0, 0)) ((x), (y),(z))= ((4), (10),(0))#. Look at the bottom row !
If #a = 4#, we have this:
#((1,2,3), (0,7,14), (0, 0,0)) ((x), (y),(z))= ((4), (10),(8))#. Again, look at the bottom row. This version of #a# that insists that #z = 8#.