Eirik hi,
looks like it is not a validation error in ur payload. A 400 with SystemError from managementfrontend usually means the backend publish workflow failed before proper validation surfaced not that ur json is wrong. If it works from the Foundry UI but fails via REST. IMHO it could be
Wrong API version. The publish endpoint is very sensitive to preview vs GA versions. Make sure u are using exactly the same API version shown in the doc and not a newer default.
Missing required hidden fields. The UI often injects internal metadata (like projectId, environmentId, or internal deployment references) that are not obvious in the minimal example. If ur second agent differs even slightly (model, tools, environment binding), publish may fail server-side.
Region limitation. The error shows swedencentral. Some Agent publish capabilities are still rolling out region by region. It may succeed in one region and fail in another even if creation works.
RBAC mismatch. Publishing an agent requires more permissions than reading or creating one. Ensure u have Azure AI Developer or Owner at the project scope, not just at resource group.
Service regression. Since UI publish works but REST does not, and the error is SystemError with empty details, this can indicate a backend issue.
Try capture the network call from the browser when publishing successfully via UI (DevTools > Network > publish request).
Compare endpoint URL, api version, exact request body, headers
Then replicate that exact call in REST.
If the exact same request still fails outside the browser so open a ticket and add correlation ID, operation ID, timestamp, region swedencentral
Because a generic SystemError from managementfrontend with no validation details usually requires backend inspection. Given the symptoms, this is more likely a service-side issue or API version mismatch than documentation being wrong.
rgds,
Alex