Error with Eigenvalue Optimization

While running this code

cvx_begin sdp
n = 6; 
k = 2;
A = randn(n);
A = A'*A;
variable X(n,n) symmetric
X == semidefinite(n);
I = eye(n);
maximize (trace(A * X))
subject to
        trace(X) == k;
        I - X == semidefinite(n);

I am getting these errors that seems to be unfamiliar:

Status: Error
Optimal value (cvx_optval): NaN
Error using validate (line 65)
validate: C is not symmetric
Error in validate (line 65)
        error('validate: C is not symmetric');
Error in sqlp (line 160)
   [blk,At,C,b,blkdim,numblk,parbarrier] = validate(blk,At,C,b,par,parbarrier);
Error in cvx_run_solver (line 46)
    [ varargout{1:nargout} ] = sfunc( inputs{:} );
Error in cvx_sdpt3>solve (line 355)
[ obj, xx, y, zz, info ] = cvx_run_solver( @sqlp, blk, Avec, Cvec, b, OPTIONS, 'obj', 'x', 'y', 'z', 'info', settings, 5 ); %#ok
Error in cvxprob/solve (line 424)
            [ x, status, tprec, iters ] = shim.solve( At, b, c, cones, quiet, prec, solv.settings );
Error in cvx_end (line 79)
    solve( prob );

I would be glad to hear any suggestion!

For what it’s worth, when I run your code I get no errors. Not sure what to suggest.

You might wish to submit a bug report on this at However, you should also try another solver, like SeDuMi, to see if it addresses your problem.