I am receiving the same thing in trying to programmatically update rectangle features:
//----------Rectangles Created with------------------------------
GuiControls.prototype.createRectangle = function( position )
{
this.engine.primitive.push(new Cesium.GeometryInstance({
geometry : new Cesium.RectangleGeometry({
rectangle : Cesium.Rectangle.fromDegrees(position.lon, position.lat, position.lon + 5.0, position.lat + 5.0),
vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT
}),
attributes : {
color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.fromRandom({alpha : 0.5}))
}
}));
}
//----------Rectangles looped through and assigned new latlon coords--------
GuiControls.prototype.updateRectangle = function( llposition, urposition, index )
{
this.engine.viewer.scene.primitives.removeAll();
this.engine.primitive[index].geometry._rectangle = Cesium.Rectangle.fromDegrees(llposition.lon, llposition.lat, urposition.lon, urposition.lat);
}
//----------After the primitive objects are updated with new latlons, Primitives added back to the scene-------------
GuiControls.prototype.renderPrimitive = function( number )
{
for (var i = 0; i < this.engine.primitive.length; i++) {
this.engine.viewer.scene.primitives.add(new Cesium.Primitive({
geometryInstances: this.engine.primitive[i],
//geometryInstances : this.engine.primitiveList,
appearance : new Cesium.PerInstanceColorAppearance()
}));
};
}
I receive the following error when the renderPrimitive function attempts to "...scene.primitive.add(new Cesium.Primitive...":
It looks like you are adding the primitive to the scene fine initially with a geometry and an appearance, but in your update function, you are removing all primitives, then trying to set the geometry of a specific primitive (which has been marked for removal).