$Version
    
    (* "13.3.1 for Mac OS X ARM (64-bit) (July 24, 2023)" *)
    
    Clear["Global`*"]
    
    eqn = 1/4 == 
       1/((3 + a) (a + 1)) + a^2/((3 a + 1) (a + 1)) + 
        1/((3 + a) (a + 1)) 1/4 (-1 + Sqrt[-1 - 2 a (1 + a) g12^2]) + 
        a^2/((3 a + 1) (a + 1)) 1/4 (-1 + Sqrt[-1 - (2 (a + 1))/a^2 g12^2]);
    
Using [`Solve`](https://reference.wolfram.com/language/ref/Solve.html) for the exact solutions
    
    (sol = Solve[eqn, a]) // Short[#, 3] &
[![enter image description here][1]][1]
    
For the [`Root`](https://reference.wolfram.com/language/ref/Root.html) expressions to return a numeric value, `g12` must have a numeric  value.
    
For example, for `g12 == 3`
    
    eqn /. sol /. g12 -> 3 // RootReduce
    
    (* {False, False, True, True, False, False, False, False, False, False} *)

As indicated in the warning message, not all solutions are valid for all values of the parameter `g12`
    
Selecting the two valid solutions for `g12 == 3`,
    
    Pick @@ ({sol, eqn /. sol} /. g12 -> 3 // RootReduce) // N
    
    (* {{a -> -0.486416 - 0.873728 I}, {a -> -0.486416 + 0.873728 I}} *)

**EDIT:** For purely imaginary `g12` and real `a`

    eqn2 = eqn /. g12 -> I*g // Simplify
    
    (* ((a^2 (3 + Sqrt[-1 + (2 g^2)/a^2 + (2 g^2)/a]))/(1 + 3 a) + (
      3 + Sqrt[-1 + 2 a g^2 + 2 a^2 g^2])/(3 + a))/(4 (1 + a)) == 1/4 *)
    
    (sol2 = Solve[{eqn2, {a, g} ∈ Reals}, a]) // Short
[![enter image description here][2]][2]
    
    DeleteDuplicates[sol2 /. ConditionalExpression[e_, cond_] :> cond]
[![enter image description here][3]][3]
    
    Plot[Evaluate[a /. sol2], {g, -1.1, 1.1},
     AxesLabel -> (Style[#, 14] & /@ {Im[Subscript[g, 12]], a})]
[![enter image description here][4]][4]


  [1]: https://i.sstatic.net/1DW3R.png
  [2]: https://i.sstatic.net/3nkHE.png
  [3]: https://i.sstatic.net/H7tIY.png
  [4]: https://i.sstatic.net/K8fzA.png