No, you can’t. Errors are for errors that happened during requests. Either the request was a success and data is returned, or an error occurred and that error is returned.
Can you give us more details about what you are trying to do? That could help us find a better solution to your problem.
First, I’m making a GET request to the server to load a list of resources (100-200). This returns an array of data. I display these resources in my application’s UI. Each resource can be clicked to open another page specially for the resource clicked. Some resources cannot be clicked because some data might be missing. To indicate that the resource has an error and cannot be clicked, I need to set an error object in the attributes.
At the end of the day, you can put pretty much whatever you want. But if you do put errors, do not put errors as defined by the specification, because it seems that those errors or specific to your application. They have nothing to do with JSON:API.