1
votes

I am getting this error but I don't know why. I am running mobx state tree (3.2.4)

:8080/main.js:52013 Uncaught (in promise) Error: [mobx-state-tree] Error while converting `""` to `AnonymousModel[]`:

    value `""` is not assignable to type: `AnonymousModel[]` (Value is not an array).
    at fail (:8080/main.js:52013)
    at typecheck$$1 (:8080/main.js:51692)
    at typecheckInternal$$1 (:8080/main.js:51678)
    at ArrayType$$1../node_modules/mobx-state-tree/dist/mobx-state-tree.module.js.ArrayType$$1.applySnapshot (:8080/main.js:52884)
    at executeAction (:8080/main.js:55058)
    at ArrayType$$1.res (:8080/main.js:55050)
    at :8080/main.js:50844
    at executeAction (:8080/main.js:55058)
    at res (:8080/main.js:55050)
    at runMiddleWares (:8080/main.js:51533)

I cannot see any indication I am trying to set an empty string to an array.

How can I pinpoint what property it is trying to apply?

1
Definitely would help to see some code :) At first glance it seems similar to the error described here: mobx-state-tree.gitbook.io/docs/getting-started#meeting-types so you may have something of that sort happening. - Rich Churcher

1 Answers

1
votes

Not easy to reply without code, but probably you're loading data that is not following the type specification of your model.
It seems you have an empty string instead of an array.


Another common mistake is to use an integer for a field of type types.identifier which expects a string.

Use a types.identifierNumber to have numerical ids.