AI-generated waypoints show in Commands grid but not on Mission Planner Plan map; Write → ArgumentNullException

Dear community, I am trying to build AI Flight Planner button in Mission planner Plan tab which receives 3 clicked waypoints in plan tab by operator and then operator clicks AI Planner button which opens chatbox where operator types commands and it is sent to backend (with openAI API) which generates waypoints for one type of vtol specs which is fixed in backend. and it sends waypoints back to plan tab and should insert but now , showing 15-20 waypoints in bottom but nothing in map

  • Mission Planner v1.3.82 build 1.3.9398
  • Custom plugin: AIPlannerForm
  1. On Plan tab, add 3 points (takeoff, mission center, land).
  2. Open AI Planner, type mission prompt, click Send Plan.
  3. Backend (OpenAI) returns JSON (~12–20 waypoints).
  4. Rows appear in Commands table, but only Home is visible on the map.
  5. Clicking Write → error: ArgumentNullException: Value cannot be null in FlightPlanner.getCmdID(JsonConvert.DeserializeObject(...)).

Expected
Generated waypoints should appear on both the grid and map, and Write should upload the mission.

Actual

  • Grid shows waypoints, map shows only Home.
  • Write fails with ArgumentNullException.

What I tried

  • Inserted rows directly into Commands grid.
  • Tried refreshing map (Invalidate/ReloadWaypoints/etc.).
  • Logged cell values.
  • Used reflection to update pointlist (unstable).

Hypothesis

  • Write expects a valid Command value.
  • If Command cell is null/empty or wrong format, getCmdID crashes.

Questions

  1. What exact format does the Command column need (e.g., "WAYPOINT", JSON, object)?
  2. Does Write build the mission from Commands grid, pointlist, or both?
  3. What’s the correct API/helper to insert waypoints so both map + UI stay in sync?