Api/views/list returns Could not load views definition file error

Version: 7.3

We have been using the REST API to create portfolios and applications. Once the set of portolios was created and computed, we started see the below error when we made a call to api/views/list, furthermore the admin page for portfolios also returns the same error.

“errors”:[{“msg”:“Could not load views definition file. Please validate views.def against schema at <sonar.host.url>/static/governance/views.xsd”

Is this a known issue, how do we recover from this and how can we troubleshoot what caused this error to happen in the first place

Hi,

To clarify: you created your portfolios and applications by uploading an xml file?

And you started seeing this error on your first calculation?

Ann

No, I used the /api/applications/create, /api/views/create endpoint not the xml file. Also a few calculations succeeded that first time we did it. When we added a new set of portfolios, it failed. We suspect it could be due to some issue in the description field. If there is a way we can look at more detailed failure messages that would help

Hi,

Could you try to execute GET api/view/definition ?
If it’s working you should be able to investigate your issue.

Regards

Hi We’re getting the same error. Is there any update on this issue? we’re using 5.6.4 version. And, we couldn’t find the api/view/definition api in 5.6.4.
We tried api/views/list. There aslo we’re getting the same error.

@vimal the current version of SonarQube is 7.7 and the current LTS is 6.7.7. You’re going to have a hard time finding support for versions older than that.

 
Ann

@ganncamp We’re in the process of moving to version 7.6. However, we need to support our internal users at-least for another 2 to 3 months.
Can you let us know why this error coming and is there any workaround to fix this? Or, can we create the view definition file manually? Where we can find that file? We really appreciate, if there is any suggestion available on this.

Hi, i’ve encounter the same issue in 7.9.1 but it occurs when i added the project with the name “alert(1”. I wont be able to remove the portfolio as the error shows.

Do we have an alternative way to remove the porfolio? i have already deleted the project.

Hi @Ram_Zamoranos,

It’s a bit involved, but you can retrieve the XML definition of your Portfolios using GET api/views/definition. You can manually edit it, and send it back using POST api/views/define. This way, you can remove the faulty project key.

We are aware of this issue, and will fix it in an upcoming release.

1 Like